Skip to content

Commit

Permalink
~runhere will now properly create temporary files for file names with…
Browse files Browse the repository at this point in the history
… no '.' in it
  • Loading branch information
AeriaVelocity committed Oct 10, 2024
1 parent 22fd7b0 commit d970014
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,13 @@ pub fn shell_command_with_file(mut command_args: Vec<String>, buffer_contents: &
}
else {
let temporary_file_name: String = if file_name.is_some() {
format!("{}", file_name.unwrap().replace(".", "-temp."))
let file = file_name.unwrap();
if file.contains(".") {
format!("{}", file.replace(".", "-temp."))
}
else {
format!("{}.temp", file)
}
}
else {
/* Do we need a random hex string? No. Is it cool anyway? YES. */
Expand All @@ -476,6 +482,8 @@ pub fn shell_command_with_file(mut command_args: Vec<String>, buffer_contents: &
format!("{}.temp", hex_string)
};

println!("writing temporary file to {}", temporary_file_name);

if command_args.len() <= 1 {
println!("run what?");
return;
Expand Down

0 comments on commit d970014

Please sign in to comment.