parent
25ef603990
commit
5964fc192c
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3302,6 +3302,7 @@ dependencies = [
|
||||||
"open",
|
"open",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"relative-path",
|
"relative-path",
|
||||||
|
"same-file",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"site",
|
"site",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
|
|
|
@ -45,6 +45,9 @@ errors = { path = "components/errors" }
|
||||||
front_matter = { path = "components/front_matter" }
|
front_matter = { path = "components/front_matter" }
|
||||||
utils = { path = "components/utils" }
|
utils = { path = "components/utils" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
same-file = "1"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"components/config",
|
"components/config",
|
||||||
|
|
|
@ -250,16 +250,15 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn strip_unc_test() {
|
fn strip_unc_test() {
|
||||||
let mut dir = temp_dir();
|
let mut dir = temp_dir();
|
||||||
dir.push("new_project");
|
dir.push("new_project1");
|
||||||
if dir.exists() {
|
if dir.exists() {
|
||||||
remove_dir_all(&dir).expect("Could not free test directory");
|
remove_dir_all(&dir).expect("Could not free test directory");
|
||||||
}
|
}
|
||||||
create_dir(&dir).expect("Could not create test directory");
|
create_dir(&dir).expect("Could not create test directory");
|
||||||
if cfg!(target_os = "windows") {
|
if cfg!(target_os = "windows") {
|
||||||
assert_eq!(
|
let stripped_path = strip_unc(&canonicalize(Path::new(&dir)).unwrap());
|
||||||
strip_unc(&canonicalize(Path::new(&dir)).unwrap()),
|
assert!(same_file::is_same_file(Path::new(&stripped_path),&dir).unwrap());
|
||||||
"C:\\Users\\VssAdministrator\\AppData\\Local\\Temp\\new_project"
|
assert!(!stripped_path.starts_with(LOCAL_UNC),"The path was not stripped.");
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
strip_unc(&canonicalize(Path::new(&dir)).unwrap()),
|
strip_unc(&canonicalize(Path::new(&dir)).unwrap()),
|
||||||
|
@ -277,15 +276,15 @@ mod tests {
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn strip_unc_required_test() {
|
fn strip_unc_required_test() {
|
||||||
let mut dir = temp_dir();
|
let mut dir = temp_dir();
|
||||||
dir.push("new_project");
|
dir.push("new_project2");
|
||||||
if dir.exists() {
|
if dir.exists() {
|
||||||
remove_dir_all(&dir).expect("Could not free test directory");
|
remove_dir_all(&dir).expect("Could not free test directory");
|
||||||
}
|
}
|
||||||
create_dir(&dir).expect("Could not create test directory");
|
create_dir(&dir).expect("Could not create test directory");
|
||||||
assert_eq!(
|
|
||||||
canonicalize(Path::new(&dir)).unwrap().to_str().unwrap(),
|
let canonicalized_path = canonicalize(Path::new(&dir)).unwrap();
|
||||||
"\\\\?\\C:\\Users\\VssAdministrator\\AppData\\Local\\Temp\\new_project"
|
assert!(same_file::is_same_file(Path::new(&canonicalized_path),&dir).unwrap());
|
||||||
);
|
assert!(canonicalized_path.to_str().unwrap().starts_with(LOCAL_UNC));
|
||||||
|
|
||||||
remove_dir_all(&dir).unwrap();
|
remove_dir_all(&dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue