diff --git a/Cargo.lock b/Cargo.lock index a7f6fc82b..4318a8b2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2599,6 +2599,7 @@ dependencies = [ "anki_io", "anyhow", "camino", + "dunce", "globset", "itertools 0.11.0", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index be3cce8c4..70a95a9af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -143,6 +143,7 @@ zip = { version = "0.6.6", default-features = false, features = ["deflate", "tim zstd = { version = "0.13.0", features = ["zstdmt"] } envy = "0.4.2" dirs = "5.0.1" +dunce = "1.0.4" # Apply mild optimizations to our dependencies in dev mode, which among other things # improves sha2 performance by about 21x. Opt 1 chosen due to diff --git a/build/ninja_gen/Cargo.toml b/build/ninja_gen/Cargo.toml index 6beef54bd..408b187ab 100644 --- a/build/ninja_gen/Cargo.toml +++ b/build/ninja_gen/Cargo.toml @@ -11,6 +11,7 @@ rust-version.workspace = true anki_io.workspace = true anyhow.workspace = true camino.workspace = true +dunce.workspace = true globset.workspace = true itertools.workspace = true lazy_static.workspace = true diff --git a/build/ninja_gen/src/git.rs b/build/ninja_gen/src/git.rs index ab7a1e72f..2b996a325 100644 --- a/build/ninja_gen/src/git.rs +++ b/build/ninja_gen/src/git.rs @@ -46,7 +46,10 @@ fn locate_git_head() -> Option { return Some(inputs![standard_path.to_string()]); } - let mut folder = Utf8Path::new(".").canonicalize_utf8().unwrap(); + let mut folder = Utf8PathBuf::from_path_buf( + dunce::canonicalize(Utf8Path::new(".").canonicalize().unwrap()).unwrap(), + ) + .unwrap(); loop { let path = folder.join(".git").join("modules"); if path.exists() {