Skip to content

Commit

Permalink
Fix windows path
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd committed Dec 14, 2021
1 parent 460e90f commit 34ee7b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ Rustc explain errors

//new
Reports scripts errors


windows cmds , utf8
9 changes: 7 additions & 2 deletions crates/irust_repl/src/cargo_cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,19 @@ pub fn cargo_add_prelude(path: PathBuf, name: &'static str) -> io::Result<()> {
.append(true)
.open(&*CARGO_TOML_FILE)?;

let path = if !cfg!(windows) {
path.display().to_string()
} else {
path.display().to_string().replace('\\', "\\\\")
};

writeln!(
f,
"
[dependencies]
{} = {{ path = \"{}\" }}
",
name,
path.display()
name, path
)
}

Expand Down

0 comments on commit 34ee7b9

Please sign in to comment.