File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -617,11 +617,15 @@ private struct UNIXPath: Path {
617
617
618
618
init ( normalizingRelativePath path: String ) {
619
619
#if os(Windows)
620
- var buffer : [ WCHAR ] = Array < WCHAR > ( repeating: 0 , count: Int ( MAX_PATH + 1 ) )
621
- _ = path. replacingOccurrences ( of: " / " , with: " \\ " ) . withCString ( encodedAs: UTF16 . self) {
622
- PathCanonicalizeW ( & buffer, $0)
620
+ if path. isEmpty || path == " . " {
621
+ self . init ( string: " . " )
622
+ } else {
623
+ var buffer : [ WCHAR ] = Array < WCHAR > ( repeating: 0 , count: Int ( MAX_PATH + 1 ) )
624
+ _ = path. replacingOccurrences ( of: " / " , with: " \\ " ) . withCString ( encodedAs: UTF16 . self) {
625
+ PathCanonicalizeW ( & buffer, $0)
626
+ }
627
+ self . init ( string: String ( decodingCString: buffer, as: UTF16 . self) )
623
628
}
624
- self . init ( string: String ( decodingCString: buffer, as: UTF16 . self) )
625
629
#else
626
630
precondition ( path. first != " / " )
627
631
You can’t perform that action at this time.
0 commit comments