Safe Haskell | None |
---|---|
Language | Haskell98 |
This module provides type-safe access to directory manipulations.
It is designed to be imported instead of System.Directory. (It is intended to provide versions of functions from that module which have equivalent functionality but are more typesafe). System.Path is a companion module providing a type-safe alternative to System.FilePath.
You will typically want to import as follows:
import Prelude hiding (FilePath) import System.Path import System.Path.Directory import System.Path.IO
Ben Moseley - (c) 2009
- createDirectory :: AbsRelClass ar => DirPath ar -> IO ()
- createDirectoryIfMissing :: AbsRelClass ar => Bool -> DirPath ar -> IO ()
- removeDirectory :: AbsRelClass ar => DirPath ar -> IO ()
- removeDirectoryRecursive :: AbsRelClass ar => DirPath ar -> IO ()
- renameDirectory :: (AbsRelClass ar1, AbsRelClass ar2) => DirPath ar1 -> DirPath ar2 -> IO ()
- getDirectoryContents :: AbsRelClass ar => DirPath ar -> IO ([RelDir], [RelFile])
- absDirectoryContents :: AbsRelClass ar => DirPath ar -> IO ([AbsDir], [AbsFile])
- relDirectoryContents :: AbsRelClass ar => DirPath ar -> IO ([RelDir], [RelFile])
- filesInDir :: AbsRelClass ar => DirPath ar -> IO [RelFile]
- dirsInDir :: AbsRelClass ar => DirPath ar -> IO [RelDir]
- getCurrentDirectory :: IO AbsDir
- setCurrentDirectory :: AbsRelClass ar => DirPath ar -> IO ()
- getHomeDirectory :: IO AbsDir
- getAppUserDataDirectory :: String -> IO AbsDir
- getUserDocumentsDirectory :: IO AbsDir
- getTemporaryDirectory :: IO AbsDir
- removeFile :: AbsRelClass ar => FilePath ar -> IO ()
- renameFile :: (AbsRelClass ar1, AbsRelClass ar2) => FilePath ar1 -> FilePath ar2 -> IO ()
- copyFile :: (AbsRelClass ar1, AbsRelClass ar2) => FilePath ar1 -> FilePath ar2 -> IO ()
- canonicalizePath :: AbsRelClass ar => Path ar fd -> IO (AbsPath fd)
- makeRelativeToCurrentDirectory :: AbsRelClass ar => Path ar fd -> IO (RelPath fd)
- findExecutable :: String -> IO (Maybe AbsFile)
- doesFileExist :: AbsRelClass ar => FilePath ar -> IO Bool
- doesDirectoryExist :: AbsRelClass ar => DirPath ar -> IO Bool
- data Permissions :: *
- getPermissions :: AbsRelClass ar => Path ar fd -> IO Permissions
- setPermissions :: AbsRelClass ar => Path ar fd -> Permissions -> IO ()
- getModificationTime :: AbsRelClass ar => Path ar fd -> IO UTCTime
Actions on directories
createDirectory :: AbsRelClass ar => DirPath ar -> IO () Source
createDirectoryIfMissing :: AbsRelClass ar => Bool -> DirPath ar -> IO () Source
removeDirectory :: AbsRelClass ar => DirPath ar -> IO () Source
removeDirectoryRecursive :: AbsRelClass ar => DirPath ar -> IO () Source
renameDirectory :: (AbsRelClass ar1, AbsRelClass ar2) => DirPath ar1 -> DirPath ar2 -> IO () Source
getDirectoryContents :: AbsRelClass ar => DirPath ar -> IO ([RelDir], [RelFile]) Source
An alias for relDirectoryContents
.
absDirectoryContents :: AbsRelClass ar => DirPath ar -> IO ([AbsDir], [AbsFile]) Source
Retrieve the contents of a directory path (which may be relative) as absolute paths
relDirectoryContents :: AbsRelClass ar => DirPath ar -> IO ([RelDir], [RelFile]) Source
Returns paths relative to the supplied (abs or relative) directory path.
eg (for current working directory of /somewhere/cwd/
):
show (relDirectoryContents "d/e/f/") == (["subDir1A","subDir1B"], ["file1A","file1B"])
filesInDir :: AbsRelClass ar => DirPath ar -> IO [RelFile] Source
A convenient alternative to relDirectoryContents
if you only want files.
dirsInDir :: AbsRelClass ar => DirPath ar -> IO [RelDir] Source
A convenient alternative to relDirectoryContents
if you only want directories.
setCurrentDirectory :: AbsRelClass ar => DirPath ar -> IO () Source
Pre-defined directories
Actions on files
removeFile :: AbsRelClass ar => FilePath ar -> IO () Source
renameFile :: (AbsRelClass ar1, AbsRelClass ar2) => FilePath ar1 -> FilePath ar2 -> IO () Source
copyFile :: (AbsRelClass ar1, AbsRelClass ar2) => FilePath ar1 -> FilePath ar2 -> IO () Source
canonicalizePath :: AbsRelClass ar => Path ar fd -> IO (AbsPath fd) Source
makeRelativeToCurrentDirectory :: AbsRelClass ar => Path ar fd -> IO (RelPath fd) Source
Existence tests
doesFileExist :: AbsRelClass ar => FilePath ar -> IO Bool Source
doesDirectoryExist :: AbsRelClass ar => DirPath ar -> IO Bool Source
Permissions
data Permissions :: *
getPermissions :: AbsRelClass ar => Path ar fd -> IO Permissions Source
setPermissions :: AbsRelClass ar => Path ar fd -> Permissions -> IO () Source
Timestamps
getModificationTime :: AbsRelClass ar => Path ar fd -> IO UTCTime Source