Skip to content

Commit

Permalink
Merge pull request #17 from sagiegurari/0.9.0
Browse files Browse the repository at this point in the history
0.9.0
  • Loading branch information
sagiegurari committed Sep 13, 2021
2 parents efdbe61 + 9e96c7d commit 7b7b637
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## CHANGELOG

### v0.9.0

* Add windows UNC path support (fsio upgrade)

### v0.8.0 (2021-05-20)

* Support providing environment variables to script process #16 (thanks @kenr)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include = [
]

[dependencies]
fsio = { version = "^0.2", features = ["temp-path"] }
fsio = { version = "^0.3", features = ["temp-path"] }

[dev-dependencies]
doc-comment = "^0.3"
Expand Down
15 changes: 13 additions & 2 deletions src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,24 @@ fn create_script_file(script: &String) -> FsIOResult<String> {
}
}

fn fix_path(path_string: &str) -> String {
if cfg!(windows) {
fsio::path::canonicalize_or(&path_string, &path_string)
} else {
path_string.to_string()
}
}

fn modify_script(script: &String, options: &ScriptOptions) -> ScriptResult<String> {
match current_dir() {
Ok(cwd_holder) => {
match cwd_holder.to_str() {
Some(cwd) => {
let cwd_string = fix_path(cwd);

// create cd command
let mut cd_command = "cd \"".to_string();
cd_command.push_str(cwd);
cd_command.push_str(&cwd_string);
cd_command.push('"');
if let Some(ref working_directory) = options.working_directory {
cd_command.push_str(" && cd \"");
Expand Down Expand Up @@ -160,7 +170,8 @@ fn spawn_script(
};

let mut all_args = if cfg!(windows) {
vec!["/C".to_string(), file.to_string()]
let win_file = fix_path(&file);
vec!["/C".to_string(), win_file]
} else {
vec![file.to_string()]
};
Expand Down

0 comments on commit 7b7b637

Please sign in to comment.