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 {
617617
618618 init ( normalizingRelativePath path: String ) {
619619 #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) )
623628 }
624- self . init ( string: String ( decodingCString: buffer, as: UTF16 . self) )
625629 #else
626630 precondition ( path. first != " / " )
627631
You can’t perform that action at this time.
0 commit comments