File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 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 {
449449
450450 var dirname : String {
451451#if os(Windows)
452- guard string != " " else {
453- return " . "
454- }
455452 let fsr : UnsafePointer < Int8 > = string. fileSystemRepresentation
456453 defer { fsr. deallocate ( ) }
457454
458455 let path : String = String ( cString: fsr)
459- return path. withCString ( encodedAs: UTF16 . self) {
456+ let dir : String = path. withCString ( encodedAs: UTF16 . self) {
460457 let data = UnsafeMutaßlePointer ( mutating: $0)
461458 PathCchRemoveFileSpec ( data, path. count)
462459 return String ( decodingCString: data, as: UTF16 . self)
463460 }
461+ // These two expressions represent for the current directory.
462+ if dir == " \\ " || dir == " " {
463+ return " . "
464+ }
465+ return dir
464466#else
465467 // FIXME: This method seems too complicated; it should be simplified,
466468 // if possible, and certainly optimized (using UTF8View).
You can’t perform that action at this time.
0 commit comments