Skip to content

Commit 7189fce

Browse files
authored
Rollup merge of #93283 - m1guelperez:master, r=Mark-Simulacrum
Fix for localized windows editions in testcase fn read_link() Issue#93211 This PR aims to fix the issue with localized windows versions that do not necessarily have the folder "Documents and settings" in English. The idea was provided by `@the8472.` We check if the "CI" environment variable is set, then we always check for the "Documents and Settings"-folder, otherwise we check if the folder exists on the local machine, and if not we skip this assert. Resoles #93211.
2 parents f58d51b + b795ae5 commit 7189fce

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: library/std/src/fs/tests.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::io::prelude::*;
22

3+
use crate::env;
34
use crate::fs::{self, File, OpenOptions};
45
use crate::io::{ErrorKind, SeekFrom};
56
use crate::path::Path;
@@ -906,7 +907,14 @@ fn read_link() {
906907
// junction
907908
assert_eq!(check!(fs::read_link(r"C:\Users\Default User")), Path::new(r"C:\Users\Default"));
908909
// junction with special permissions
909-
assert_eq!(check!(fs::read_link(r"C:\Documents and Settings\")), Path::new(r"C:\Users"));
910+
// Since not all localized windows versions contain the folder "Documents and Settings" in english,
911+
// we will briefly check, if it exists and otherwise skip the test. Except during CI we will always execute the test.
912+
if Path::new(r"C:\Documents and Settings\").exists() || env::var_os("CI").is_some() {
913+
assert_eq!(
914+
check!(fs::read_link(r"C:\Documents and Settings\")),
915+
Path::new(r"C:\Users")
916+
);
917+
}
910918
}
911919
let tmpdir = tmpdir();
912920
let link = tmpdir.join("link");

0 commit comments

Comments
 (0)