We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f771460 commit f726748Copy full SHA for f726748
Sources/TSCBasic/Path.swift
@@ -254,7 +254,14 @@ public struct RelativePath: Hashable {
254
/// normalization or canonicalization. This will construct a path without
255
/// an anchor and thus may be invalid.
256
fileprivate init(unsafeUncheckedPath string: String) {
257
- self.init(PathImpl(string: string))
+ if string.isEmpty {
258
+ self.init(PathImpl(string: string))
259
+ } else {
260
+ let normalized: UnsafePointer<Int8> = string.fileSystemRepresentation
261
+ defer { normalized.deallocate() }
262
+
263
+ self.init(PathImpl(string: String(cString: normalized)))
264
+ }
265
}
266
267
/// Initializes the RelativePath from `str`, which must be a relative path
0 commit comments