InMemoryFileSystem
Concrete FileSystem implementation which simulates an empty disk.
final class InMemoryFileSystem
Concrete FileSystem implementation which simulates an empty disk.
final class InMemoryFileSystem
import Basics
protocol Sendable
init()
convenience init(emptyFiles files: String...)
Create a new file system with an empty file at each provided path.
convenience init(emptyFiles files: [String])
Create a new file system with an empty file at each provided path.
convenience init(files: [String : ByteString])
Create a new file system with the given files, provided as a map from file path to contents.
var cachesDirectory: TSCBasic.AbsolutePath? { get }
var currentWorkingDirectory: TSCBasic.AbsolutePath? { get }
Virtualized current working directory.
var homeDirectory: TSCBasic.AbsolutePath { get throws }
var tempDirectory: TSCBasic.AbsolutePath { get throws }
func changeCurrentWorkingDirectory(to path: TSCBasic.AbsolutePath) throws
func chmod(_ mode: FileMode, path: TSCBasic.AbsolutePath, options: Set<FileMode.Option>) throws
func copy() -> InMemoryFileSystem
Creates deep copy of the object.
func copy(from sourcePath: TSCBasic.AbsolutePath, to destinationPath: TSCBasic.AbsolutePath) throws
func createDirectory(_ path: TSCBasic.AbsolutePath, recursive: Bool) throws
func createSymbolicLink(_ path: TSCBasic.AbsolutePath, pointingAt destination: TSCBasic.AbsolutePath, relative: Bool) throws
func exists(_ path: TSCBasic.AbsolutePath, followSymlink: Bool) -> Bool
func getDirectoryContents(_ path: TSCBasic.AbsolutePath) throws -> [String]
func isDirectory(_ path: TSCBasic.AbsolutePath) -> Bool
func isExecutableFile(_ path: TSCBasic.AbsolutePath) -> Bool
func isFile(_ path: TSCBasic.AbsolutePath) -> Bool
func isReadable(_ path: TSCBasic.AbsolutePath) -> Bool
func isSymlink(_ path: TSCBasic.AbsolutePath) -> Bool
func isWritable(_ path: TSCBasic.AbsolutePath) -> Bool
func move(from sourcePath: TSCBasic.AbsolutePath, to destinationPath: TSCBasic.AbsolutePath) throws
func readFileContents(_ path: TSCBasic.AbsolutePath) throws -> ByteString
func removeFileTree(_ path: TSCBasic.AbsolutePath) throws
func updatePermissions(_ path: AbsolutePath, isExecutable: Bool) throws
func withLock<T>(on path: TSCBasic.AbsolutePath, type: FileLock.LockType = .exclusive, _ body: () throws -> T) throws -> T
func withLock<T>(on path: TSCBasic.AbsolutePath, type: FileLock.LockType, blocking: Bool, _ body: () throws -> T) throws -> T
func writeFileContents(_ path: TSCBasic.AbsolutePath, bytes: ByteString) throws
func writeFileContents(_ path: TSCBasic.AbsolutePath, bytes: ByteString, atomically: Bool) throws