Safe Haskell | Safe |
---|---|
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 :: AbsRel ar => DirPath ar -> IO ()
- createDirectoryIfMissing :: AbsRel ar => Bool -> DirPath ar -> IO ()
- removeDirectory :: AbsRel ar => DirPath ar -> IO ()
- removeDirectoryRecursive :: AbsRel ar => DirPath ar -> IO ()
- renameDirectory :: (AbsRel ar1, AbsRel ar2) => DirPath ar1 -> DirPath ar2 -> IO ()
- getDirectoryContents :: AbsRel ar => DirPath ar -> IO [RelFileDir]
- absDirectoryContents :: AbsRel ar => DirPath ar -> IO ([AbsDir], [AbsFile])
- relDirectoryContents :: AbsRel ar => DirPath ar -> IO ([RelDir], [RelFile])
- filesInDir :: AbsRel ar => DirPath ar -> IO [RelFile]
- dirsInDir :: AbsRel ar => DirPath ar -> IO [RelDir]
- getCurrentDirectory :: IO AbsDir
- setCurrentDirectory :: AbsRel ar => DirPath ar -> IO ()
- getHomeDirectory :: IO AbsDir
- getAppUserDataDirectory :: String -> IO AbsDir
- getUserDocumentsDirectory :: IO AbsDir
- getTemporaryDirectory :: IO AbsDir
- removeFile :: AbsRel ar => FilePath ar -> IO ()
- renameFile :: (AbsRel ar1, AbsRel ar2) => FilePath ar1 -> FilePath ar2 -> IO ()
- copyFile :: (AbsRel ar1, AbsRel ar2) => FilePath ar1 -> FilePath ar2 -> IO ()
- canonicalizePath :: (AbsRel ar, FileDir fd) => Path ar fd -> IO (AbsPath fd)
- makeRelativeToCurrentDirectory :: (AbsRel ar, FileDir fd) => Path ar fd -> IO (RelPath fd)
- findExecutable :: String -> IO (Maybe AbsFile)
- doesFileExist :: AbsRel ar => FilePath ar -> IO Bool
- doesDirectoryExist :: AbsRel ar => DirPath ar -> IO Bool
- data Permissions :: *
- getPermissions :: (AbsRel ar, FileDir fd) => Path ar fd -> IO Permissions
- setPermissions :: (AbsRel ar, FileDir fd) => Path ar fd -> Permissions -> IO ()
- getModificationTime :: (AbsRel ar, FileDir fd) => Path ar fd -> IO UTCTime
Actions on directories
getDirectoryContents :: AbsRel ar => DirPath ar -> IO [RelFileDir] Source #
Retrieve the contents of a directory without any directory prefixes.
In contrast to getDirectoryContents
,
exclude special directories "." and "..".
absDirectoryContents :: AbsRel ar => DirPath ar -> IO ([AbsDir], [AbsFile]) Source #
Retrieve the contents of a directory path (which may be relative) as absolute paths
relDirectoryContents :: AbsRel 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 :: AbsRel ar => DirPath ar -> IO [RelFile] Source #
A convenient alternative to relDirectoryContents
if you only want files.
dirsInDir :: AbsRel ar => DirPath ar -> IO [RelDir] Source #
A convenient alternative to relDirectoryContents
if you only want directories.
Pre-defined directories
Actions on files
Existence tests
Permissions
data Permissions :: * #
getPermissions :: (AbsRel ar, FileDir fd) => Path ar fd -> IO Permissions Source #
setPermissions :: (AbsRel ar, FileDir fd) => Path ar fd -> Permissions -> IO () Source #