Module CPM.FileUtil

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

Summary of exported operations:

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.
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.
quote :: String -> String   
Puts a file argument into quotes to avoid problems with files containing blanks.
tempDir :: IO String   
Gets CPM's temporary directory.
inTempDir :: IO a -> IO a   
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.
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.
whenFileExists :: String -> IO () -> IO ()   
Performs an action when a file exists.
ifFileExists :: String -> IO a -> IO a -> IO a   
Performs one of two actions depending on the existence of a file.

Exported operations:

joinSearchPath :: [String] -> String   

Joins a list of directories into a search path.

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

Recursively copies a directory structure.

linkTarget :: String -> IO String   

Gets the target of a symlink.

quote :: String -> String   

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   

Gets CPM's temporary directory.

inTempDir :: IO a -> IO a   

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.

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

Performs an action when a file exists.

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

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