Fix for issue #93283

This commit is contained in:
Miguel Perez 2022-03-08 10:16:18 +01:00
parent 17dfae79bb
commit b795ae5280

View File

@ -1,5 +1,6 @@
use crate::io::prelude::*;
use crate::env;
use crate::fs::{self, File, OpenOptions};
use crate::io::{ErrorKind, SeekFrom};
use crate::path::Path;
@ -906,7 +907,14 @@ fn read_link() {
// junction
assert_eq!(check!(fs::read_link(r"C:\Users\Default User")), Path::new(r"C:\Users\Default"));
// junction with special permissions
assert_eq!(check!(fs::read_link(r"C:\Documents and Settings\")), Path::new(r"C:\Users"));
// Since not all localized windows versions contain the folder "Documents and Settings" in english,
// we will briefly check, if it exists and otherwise skip the test. Except during CI we will always execute the test.
if Path::new(r"C:\Documents and Settings\").exists() || env::var_os("CI").is_some() {
assert_eq!(
check!(fs::read_link(r"C:\Documents and Settings\")),
Path::new(r"C:\Users")
);
}
}
let tmpdir = tmpdir();
let link = tmpdir.join("link");