Copyright | (c) Fuzz Leonard 2025 |
---|---|
License | MIT |
Maintainer | cyborg@bionicfuzz.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Clod.FileSystem.Operations
Contents
Description
This module provides basic file system operations like finding files, copying files, and safely removing files.
Synopsis
- findAllFiles :: FilePath -> [FilePath] -> ClodM [FilePath]
- copyFile :: FilePath -> FilePath -> IO ()
- safeRemoveFile :: FilePath -> ClodM ()
- safeReadFile :: FileReadCap -> FilePath -> ClodM ByteString
- safeWriteFile :: FileWriteCap -> FilePath -> ByteString -> ClodM ()
- safeCopyFile :: FileReadCap -> FileWriteCap -> FilePath -> FilePath -> ClodM ()
File operations
findAllFiles :: FilePath -> [FilePath] -> ClodM [FilePath] Source #
Recursively find all files in a directory
This function takes a base path and a list of files/directories, and recursively finds all files within those directories. It returns paths relative to the base path.
-- Find all files in the "src" directory files <- findAllFiles "pathto/repo" ["src"] -- Find all files in multiple directories files <- findAllFiles "pathto/repo" ["src", "docs", "tests"] -- Find all files in the root directory (without "./" prefix) files <- findAllFiles "pathto/repo" [""]
Copy a file with its permissions. If the destination file already exists, it is replaced atomically. Neither path may refer to an existing directory. No exceptions are thrown if the permissions could not be copied.
safeRemoveFile :: FilePath -> ClodM () Source #
Safely remove a file, ignoring errors if it doesn't exist
safeReadFile :: FileReadCap -> FilePath -> ClodM ByteString Source #
Safe file reading that checks capabilities
safeWriteFile :: FileWriteCap -> FilePath -> ByteString -> ClodM () Source #
Safe file writing that checks capabilities
safeCopyFile :: FileReadCap -> FileWriteCap -> FilePath -> FilePath -> ClodM () Source #
Safe file copying that checks capabilities for both read and write