File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -449,12 +449,15 @@ private struct UNIXPath: Path {
449449
450450 var dirname : String {
451451#if os(Windows)
452+ guard string != " " else {
453+ return " . "
454+ }
452455 let fsr : UnsafePointer < Int8 > = string. fileSystemRepresentation
453456 defer { fsr. deallocate ( ) }
454457
455458 let path : String = String ( cString: fsr)
456459 return path. withCString ( encodedAs: UTF16 . self) {
457- let data = UnsafeMutablePointer ( mutating: $0)
460+ let data = UnsafeMutaßlePointer ( mutating: $0)
458461 PathCchRemoveFileSpec ( data, path. count)
459462 return String ( decodingCString: data, as: UTF16 . self)
460463 }
@@ -685,6 +688,9 @@ private struct UNIXPath: Path {
685688
686689 init ( validatingAbsolutePath path: String ) throws {
687690 #if os(Windows)
691+ guard path != " " else {
692+ throw PathValidationError . invalidAbsolutePath ( path)
693+ }
688694 let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
689695 defer { fsr. deallocate ( ) }
690696
@@ -707,6 +713,9 @@ private struct UNIXPath: Path {
707713
708714 init ( validatingRelativePath path: String ) throws {
709715 #if os(Windows)
716+ guard path != " " else {
717+ self . init ( normalizingRelativePath: path)
718+ }
710719 let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
711720 defer { fsr. deallocate ( ) }
712721
You can’t perform that action at this time.
0 commit comments