File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,18 @@ public struct RelativePath: Hashable {
254
254
/// normalization or canonicalization. This will construct a path without
255
255
/// an anchor and thus may be invalid.
256
256
fileprivate init ( unsafeUncheckedPath string: String ) {
257
- self . init ( PathImpl ( string: string) )
257
+ if string. isEmpty {
258
+ self . init ( PathImpl ( string: string) )
259
+ } else {
260
+ #if _runtime(_ObjC)
261
+ self . init ( PathImpl ( string: string. fileSystemRepresentation) )
262
+ #else
263
+ let normalized : UnsafePointer < Int8 > = string. fileSystemRepresentation
264
+ defer { normalized. deallocate ( ) }
265
+
266
+ self . init ( PathImpl ( string: String ( cString: normalized) ) )
267
+ #endif
268
+ }
258
269
}
259
270
260
271
/// Initializes the RelativePath from `str`, which must be a relative path
You can’t perform that action at this time.
0 commit comments