Some utilities for deailing with files and directories for the Curry Package Manager.
joinSearchPath
:: [String] -> String
Joins a list of directories into a search path.
copyDirectory
:: String -> String -> IO ()
Recursively copies a directory structure.
copyDirectoryFollowingSymlinks
:: String -> String -> IO ()
Recursively copies a directory structure following symlinks, i.e. links get replaced by copies in the destination.
createSymlink
:: String -> String -> IO Int
Creates a new symlink.
removeSymlink
:: String -> IO Int
Deletes a symlink.
isSymlink
:: String -> IO Bool
Tests whether a file is a symlink.
linkTarget
:: String -> IO String
Gets the target of a symlink.
getRealPath
:: String -> IO String
Returns the absolute real path for a given file path by following all symlinks in all path components.
Puts a file argument into quotes to avoid problems with files containing blanks.
Gets a temporary directory for some CPM command.
cleanTempDir
:: IO ()
Removes the temporary directory for some CPM command.
Executes an IO action with the current directory set to CPM's temporary directory.
inDirectory
:: String -> IO a -> IO a
Executes an IO action with the current directory set to a specific directory.
recreateDirectory
:: String -> IO ()
Recreates a directory. Deletes its contents if it already exists.
removeDirectoryComplete
:: String -> IO ()
Deletes a directory and its contents, if it exists, otherwise nothing is done.
safeReadFile
:: String -> IO (Either IOError String)
Reads the complete contents of a file and catches any error (which is returned).
checkAndGetVisibleDirectoryContents
:: String -> IO [String]
Returns the list of all visible entries in a directory (i.e., not starting with ) and terminates with an error message if the directory does not exist.
ifFileExists
:: String -> IO a -> IO a -> IO a
Performs one of two actions depending on the existence of a file.
whenFileExists
:: String -> IO () -> IO ()
Performs an action when a file exists.
writeFileIfNotExists
:: String -> String -> IO ()
Writes a file with a given contents if it does not exist.