Skip to content

Commit d4ca68c

Browse files
authored
Avoid calling NSString.fileSystemRepresentation from an empty string - causes crash on Linux (#536)
1 parent e783da9 commit d4ca68c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/TSCBasic/FileSystem.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ private struct LocalFileSystem: FileSystem {
522522

523523
var currentWorkingDirectory: AbsolutePath? {
524524
let cwdStr = FileManager.default.currentDirectoryPath
525+
526+
guard !cwdStr.isEmpty else {
527+
return nil
528+
}
525529

526530
#if _runtime(_ObjC)
527531
// The ObjC runtime indicates that the underlying Foundation has ObjC

0 commit comments

Comments
 (0)