Skip to content

Commit

Permalink
fix: overwrite current dir on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
iho committed Oct 9, 2023
1 parent a675e70 commit c7ef9c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cargo-near/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ where
if let Some(path) = working_dir {
let path = path.as_ref();
log::debug!("Setting cargo working dir to '{}'", path);
cmd.current_dir(path);
#[cfg(target_os = "windows")]
{
let mut path = path.as_std_path().to_string_lossy().to_string();
// remove first 4 elements from path string
path.drain(..4);
let path = std::path::PathBuf::from(path);
cmd.current_dir(path);
}
cmd.current_dir(path);
}

cmd.arg(command);
Expand Down

0 comments on commit c7ef9c5

Please sign in to comment.