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.
This commit is contained in:
Dylan DPC 2022-03-11 13:38:36 +01:00 committed by GitHub
commit 7189fceab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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");