Skip to content

Commit 2f0f99c

Browse files
committed
[Windows] Special case ~ as an absolute path
PathIsRelativeW doesn't consider ~ to be an absolute path, so we special case it in to match posix behaviour
1 parent 545cc23 commit 2f0f99c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Foundation/NSPathUtilities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extension String {
125125

126126
internal var isAbsolutePath: Bool {
127127
#if os(Windows)
128-
return !withCString(encodedAs: UTF16.self, PathIsRelativeW)
128+
return hasPrefix("~") || !withCString(encodedAs: UTF16.self, PathIsRelativeW)
129129
#else
130130
return hasPrefix("~") || hasPrefix("/")
131131
#endif

0 commit comments

Comments
 (0)