diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift index 8f0cc22b..18503ff4 100644 --- a/Sources/TSCBasic/FileSystem.swift +++ b/Sources/TSCBasic/FileSystem.swift @@ -1164,8 +1164,19 @@ public class RerootedFileSystemView: FileSystem { // `underlyingFileSystem` is required to be `Sendable`. extension RerootedFileSystemView: @unchecked Sendable {} +private var _localFileSystem: any FileSystem = LocalFileSystem() + /// Public access to the local FS proxy. -public var localFileSystem: FileSystem = LocalFileSystem() +public var localFileSystem: any FileSystem { + get { + return _localFileSystem + } + + @available(*, deprecated, message: "This global should never be mutable and is supposed to be read-only. Deprecated in Apr 2023.") + set { + _localFileSystem = newValue + } +} // `LocalFileSystem` doesn't hold any internal state and all of its underlying operations are blocking. extension LocalFileSystem: @unchecked Sendable {}