From 5404fdf38447adea2fc181664ad3675fea1657e5 Mon Sep 17 00:00:00 2001 From: Robert Connell Date: Wed, 10 Dec 2025 12:11:49 -0500 Subject: [PATCH] Avoid calling NSString.fileSystemRepresentation from an empty string - causes crash on Linux --- Sources/TSCBasic/FileSystem.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift index 69e39e89..8f3e4f7e 100644 --- a/Sources/TSCBasic/FileSystem.swift +++ b/Sources/TSCBasic/FileSystem.swift @@ -522,6 +522,10 @@ private struct LocalFileSystem: FileSystem { var currentWorkingDirectory: AbsolutePath? { let cwdStr = FileManager.default.currentDirectoryPath + + guard !cwdStr.isEmpty else { + return nil + } #if _runtime(_ObjC) // The ObjC runtime indicates that the underlying Foundation has ObjC