Skip to content

Commit 8fe451b

Browse files
committed
Handle empty path on Windows
1 parent 2954e55 commit 8fe451b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/TSCBasic/Path.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ private struct UNIXPath: Path {
685685

686686
init(validatingAbsolutePath path: String) throws {
687687
#if os(Windows)
688+
guard path != "" else {
689+
throw PathValidationError.invalidAbsolutePath(path)
690+
}
688691
let fsr: UnsafePointer<Int8> = path.fileSystemRepresentation
689692
defer { fsr.deallocate() }
690693

@@ -707,6 +710,9 @@ private struct UNIXPath: Path {
707710

708711
init(validatingRelativePath path: String) throws {
709712
#if os(Windows)
713+
guard path != "" else {
714+
self.init(normalizingRelativePath: path)
715+
}
710716
let fsr: UnsafePointer<Int8> = path.fileSystemRepresentation
711717
defer { fsr.deallocate() }
712718

0 commit comments

Comments
 (0)