File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -258,10 +258,9 @@ public struct RelativePath: Hashable {
258
258
self . init ( PathImpl ( string: string) )
259
259
} else {
260
260
#if _runtime(_ObjC)
261
- self . init ( PathImpl ( string: withUnsafeTemporaryAllocation ( of: Int8 . self, capacity: Int ( PATH_MAX) + 1 ) {
262
- string. getFileSystemRepresentation ( $0. baseAddress, maxLength: $0. count)
263
- return String ( cString: $0. baseAddress!)
264
- } ) )
261
+ let normalized : [ Int8 ] = Array < Int8 > ( unsafeUninitializedCapacity: Int ( PATH_MAX) + 1 )
262
+ string. getFileSystemRepresentation ( & normalized, maxLength: normalized. count)
263
+ self . init ( PathImpl ( string: String ( cString: normalized) ) )
265
264
#else
266
265
let normalized : UnsafePointer < Int8 > = string. fileSystemRepresentation
267
266
defer { normalized. deallocate ( ) }
You can’t perform that action at this time.
0 commit comments