clod
Copyright(c) Fuzz Leonard 2025
LicenseMIT
Maintainercyborg@bionicfuzz.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Clod.FileSystem.Operations

Description

This module provides basic file system operations like finding files, copying files, and safely removing files.

Synopsis

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" [""]

copyFile #

Arguments

:: FilePath

Source filename

-> FilePath

Destination filename

-> IO () 

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