From b795ae52804e1002e3993551dae69aae745237ce Mon Sep 17 00:00:00 2001 From: Miguel Perez Date: Tue, 8 Mar 2022 10:16:18 +0100 Subject: [PATCH] Fix for issue #93283 --- library/std/src/fs/tests.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index a62c01ef29b..ac8507858ed 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -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");