File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -397,9 +397,17 @@ extension FileManager {
397
397
}
398
398
399
399
let substituteNameBuff = Data ( bytes: pathBufferPtr + substituteNameOffset, count: substituteNameBytes)
400
- guard let substitutePath = String ( data: substituteNameBuff, encoding: . utf16LittleEndian) else {
400
+ guard var substitutePath = String ( data: substituteNameBuff, encoding: . utf16LittleEndian) else {
401
401
throw _NSErrorWithWindowsError ( DWORD ( ERROR_INVALID_DATA) , reading: false )
402
402
}
403
+
404
+ // Canonicalize the NT Object Manager Path to the DOS style path
405
+ // instead. Unfortunately, there is no nice API which can allow us to
406
+ // do this in a guranteed way.
407
+ let kObjectManagerPrefix = " \\ ?? \\ "
408
+ if substitutePath. hasPrefix ( kObjectManagerPrefix) {
409
+ substitutePath = String ( substitutePath. dropFirst ( kObjectManagerPrefix. count) )
410
+ }
403
411
return substitutePath
404
412
}
405
413
You can’t perform that action at this time.
0 commit comments