File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -449,18 +449,20 @@ private struct UNIXPath: Path {
449
449
450
450
var dirname : String {
451
451
#if os(Windows)
452
- guard string != " " else {
453
- return " . "
454
- }
455
452
let fsr : UnsafePointer < Int8 > = string. fileSystemRepresentation
456
453
defer { fsr. deallocate ( ) }
457
454
458
455
let path : String = String ( cString: fsr)
459
- return path. withCString ( encodedAs: UTF16 . self) {
456
+ let dir : String = path. withCString ( encodedAs: UTF16 . self) {
460
457
let data = UnsafeMutaßlePointer ( mutating: $0)
461
458
PathCchRemoveFileSpec ( data, path. count)
462
459
return String ( decodingCString: data, as: UTF16 . self)
463
460
}
461
+ // These two expressions represent for the current directory.
462
+ if dir == " \\ " || dir == " " {
463
+ return " . "
464
+ }
465
+ return dir
464
466
#else
465
467
// FIXME: This method seems too complicated; it should be simplified,
466
468
// if possible, and certainly optimized (using UTF8View).
You can’t perform that action at this time.
0 commit comments