We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1203e08 commit 2dbda0aCopy full SHA for 2dbda0a
library/std/src/sys/windows/fs.rs
@@ -1236,7 +1236,19 @@ pub fn link(_original: &Path, _link: &Path) -> io::Result<()> {
1236
}
1237
1238
pub fn stat(path: &Path) -> io::Result<FileAttr> {
1239
- metadata(path, ReparsePoint::Follow)
+ match metadata(path, ReparsePoint::Follow) {
1240
+ Err(err) => {
1241
+ if err.raw_os_error() == Some(c::ERROR_CANT_ACCESS_FILE as i32) {
1242
+ if let Ok(attrs) = lstat(path) {
1243
+ if !attrs.file_type().is_symlink() {
1244
+ return Ok(attrs);
1245
+ }
1246
1247
1248
+ Err(err)
1249
+ },
1250
+ Ok(attrs) => Ok(attrs),
1251
1252
1253
1254
pub fn lstat(path: &Path) -> io::Result<FileAttr> {
0 commit comments