Module CPM.FileUtil

Some utilities for deailing with files and directories for the Curry Package Manager.

Summary of exported operations:

joinSearchPath :: [String] -> String  Deterministic 
Joins a list of directories into a search path.
copyDirectory :: String -> String -> IO ()  Deterministic 
Recursively copies a directory structure.
copyDirectoryFollowingSymlinks :: String -> String -> IO ()  Deterministic 
Recursively copies a directory structure following symlinks, i.e.
createSymlink :: String -> String -> IO Int  Deterministic 
Creates a new symlink.
removeSymlink :: String -> IO Int  Deterministic 
Deletes a symlink.
isSymlink :: String -> IO Bool  Deterministic 
Tests whether a file is a symlink.
linkTarget :: String -> IO String  Deterministic 
Gets the target of a symlink.
quote :: String -> String  Deterministic 
Puts a file argument into quotes to avoid problems with files containing blanks.
tempDir :: IO String  Deterministic 
Gets a temporary directory for some CPM command.
cleanTempDir :: IO ()  Deterministic 
Removes the temporary directory for some CPM command.
inTempDir :: IO a -> IO a  Deterministic 
Executes an IO action with the current directory set to CPM's temporary directory.
inDirectory :: String -> IO a -> IO a  Deterministic 
Executes an IO action with the current directory set to a specific directory.
recreateDirectory :: String -> IO ()  Deterministic 
Recreates a directory.
removeDirectoryComplete :: String -> IO ()  Deterministic 
Deletes a directory and its contents, if it exists, otherwise nothing is done.
safeReadFile :: String -> IO (Either IOError String)  Deterministic 
Reads the complete contents of a file and catches any error (which is returned).
checkAndGetVisibleDirectoryContents :: String -> IO [String]  Deterministic 
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.
whenFileExists :: String -> IO () -> IO ()  Deterministic 
Performs an action when a file exists.
ifFileExists :: String -> IO a -> IO a -> IO a  Deterministic 
Performs one of two actions depending on the existence of a file.

Exported operations:

joinSearchPath :: [String] -> String  Deterministic 

Joins a list of directories into a search path.

copyDirectory :: String -> String -> IO ()  Deterministic 

Recursively copies a directory structure.

linkTarget :: String -> IO String  Deterministic 

Gets the target of a symlink.

quote :: String -> String  Deterministic 

Puts a file argument into quotes to avoid problems with files containing blanks.

Further infos:
  • solution complete, i.e., able to compute all solutions

tempDir :: IO String  Deterministic 

Gets a temporary directory for some CPM command.

cleanTempDir :: IO ()  Deterministic 

Removes the temporary directory for some CPM command.

inTempDir :: IO a -> IO a  Deterministic 

Executes an IO action with the current directory set to CPM's temporary directory.

inDirectory :: String -> IO a -> IO a  Deterministic 

Executes an IO action with the current directory set to a specific directory.

recreateDirectory :: String -> IO ()  Deterministic 

Recreates a directory. Deletes its contents if it already exists.

removeDirectoryComplete :: String -> IO ()  Deterministic 

Deletes a directory and its contents, if it exists, otherwise nothing is done.

safeReadFile :: String -> IO (Either IOError String)  Deterministic 

Reads the complete contents of a file and catches any error (which is returned).

checkAndGetVisibleDirectoryContents :: String -> IO [String]  Deterministic 

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.

whenFileExists :: String -> IO () -> IO ()  Deterministic 

Performs an action when a file exists.

ifFileExists :: String -> IO a -> IO a -> IO a  Deterministic 

Performs one of two actions depending on the existence of a file.