Skip to content

Commit 3633e02

Browse files
committed
fix: improve names given to temporary files in ui Run support
Signed-off-by: Nick Mitchell <[email protected]>
1 parent 3e17654 commit 3633e02

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pdl-live-react/src-tauri/src/cli/run.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use ::file_diff::diff;
22
use ::std::fs::{copy, create_dir_all};
3-
use ::std::path::PathBuf;
3+
use ::std::path::{Path, PathBuf};
44
use duct::cmd;
55

66
use tauri::path::BaseDirectory;
@@ -76,7 +76,10 @@ pub fn run_pdl_program(
7676
data: Option<&tauri_plugin_cli::ArgData>,
7777
stream: Option<&tauri_plugin_cli::ArgData>,
7878
) -> Result<(), tauri::Error> {
79-
println!("Running {:?}", source_file_path);
79+
println!(
80+
"Running {:#?}",
81+
Path::new(&source_file_path).file_name().unwrap()
82+
);
8083
let bin_path = pip_install_if_needed(app_handle)?;
8184
let trace_arg = if let Some(arg) = trace_file {
8285
if let serde_json::Value::String(f) = &arg.value {

pdl-live-react/src-tauri/src/commands/replay_prep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use tempfile::Builder;
88
#[tauri::command]
99
pub async fn replay_prep(trace: String, name: String) -> Result<(String, String, String), String> {
1010
let mut input = Builder::new()
11-
.prefix(&name)
11+
.prefix(&format!("{}-", name))
1212
.suffix(".pdl")
1313
.tempfile()
1414
.map_err(|e| e.to_string())?;

pdl-live-react/src/view/masonry/MasonryCombo.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ export default function MasonryCombo({ value, setValue }: Props) {
110110

111111
const [cmd, input, output] = (await invoke("replay_prep", {
112112
trace: JSON.stringify(runThisBlock),
113-
name:
114-
runThisBlock.description?.slice(0, 20).replace(/\s/g, "-") ?? "trace",
113+
name: block.description?.slice(0, 30).replace(/\s/g, "-") ?? "trace",
115114
})) as [string, string, string]
116115
console.error(`Replaying with cmd=${cmd} input=${input} output=${output}`)
117116

0 commit comments

Comments
 (0)