File tree 1 file changed +10
-1
lines changed
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 {
449
449
450
450
var dirname : String {
451
451
#if os(Windows)
452
+ guard string != " " else {
453
+ return " . "
454
+ }
452
455
let fsr : UnsafePointer < Int8 > = string. fileSystemRepresentation
453
456
defer { fsr. deallocate ( ) }
454
457
455
458
let path : String = String ( cString: fsr)
456
459
return path. withCString ( encodedAs: UTF16 . self) {
457
- let data = UnsafeMutablePointer ( mutating: $0)
460
+ let data = UnsafeMutaßlePointer ( mutating: $0)
458
461
PathCchRemoveFileSpec ( data, path. count)
459
462
return String ( decodingCString: data, as: UTF16 . self)
460
463
}
@@ -685,6 +688,9 @@ private struct UNIXPath: Path {
685
688
686
689
init ( validatingAbsolutePath path: String ) throws {
687
690
#if os(Windows)
691
+ guard path != " " else {
692
+ throw PathValidationError . invalidAbsolutePath ( path)
693
+ }
688
694
let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
689
695
defer { fsr. deallocate ( ) }
690
696
@@ -707,6 +713,9 @@ private struct UNIXPath: Path {
707
713
708
714
init ( validatingRelativePath path: String ) throws {
709
715
#if os(Windows)
716
+ guard path != " " else {
717
+ self . init ( normalizingRelativePath: path)
718
+ }
710
719
let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
711
720
defer { fsr. deallocate ( ) }
712
721
You can’t perform that action at this time.
0 commit comments