We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dfd2b64 + 32c589b commit 2a3c0e3Copy full SHA for 2a3c0e3
library/std/src/sys/windows/fs.rs
@@ -1236,7 +1236,17 @@ 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) if err.raw_os_error() == Some(c::ERROR_CANT_ACCESS_FILE as i32) => {
1241
+ if let Ok(attrs) = lstat(path) {
1242
+ if !attrs.file_type().is_symlink() {
1243
+ return Ok(attrs);
1244
+ }
1245
1246
+ Err(err)
1247
1248
+ result => result,
1249
1250
1251
1252
pub fn lstat(path: &Path) -> io::Result<FileAttr> {
0 commit comments