about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMiguel Perez <miguel@Miguel.com>2022-03-08 10:16:18 +0100
committerMiguel Perez <miguel@Miguel.com>2022-03-08 10:16:18 +0100
commitb795ae52804e1002e3993551dae69aae745237ce (patch)
tree12d89fbb79a4e47df1e51d921528a5ae9c3de17c
parent17dfae79bbc3dabe1427073086acf7f7bd45148c (diff)
downloadrust-b795ae52804e1002e3993551dae69aae745237ce.tar.gz
rust-b795ae52804e1002e3993551dae69aae745237ce.zip
Fix for issue #93283
-rw-r--r--library/std/src/fs/tests.rs10
1 files changed, 9 insertions, 1 deletions
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");