Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- createDirectory :: ReadFilePathT IO ()
- createDirectoryIfMissing :: Bool -> ReadFilePathT IO ()
- removeDirectory :: ReadFilePathT IO ()
- removeDirectoryRecursive :: ReadFilePathT IO ()
- removePathForcibly :: ReadFilePathT IO ()
- renameDirectory :: FilePath -> ReadFilePathT IO ()
- listDirectory :: ReadFilePathT IO [FilePath]
- getDirectoryContents :: ReadFilePathT IO [FilePath]
- withCurrentDirectory :: IO a -> ReadFilePathT IO a
- getXdgDirectory :: XdgDirectory -> ReadFilePathT IO FilePath
- getAppUserDataDirectory :: ReadFilePathT IO FilePath
- removeFile :: ReadFilePathT IO ()
- renameFile :: FilePath -> ReadFilePathT IO ()
- renamePath :: FilePath -> ReadFilePathT IO ()
- copyFile :: FilePath -> ReadFilePathT IO ()
- copyFileWithMetadata :: FilePath -> ReadFilePathT IO ()
- getFileSize :: ReadFilePathT IO Integer
- canonicalizePath :: ReadFilePathT IO FilePath
- makeAbsolute :: ReadFilePathT IO FilePath
- makeRelativeToCurrentDirectory :: ReadFilePathT IO FilePath
- doesPathExist :: ReadFilePathT IO Bool
- doesFileExist :: ReadFilePathT IO Bool
- doesDirectoryExist :: ReadFilePathT IO Bool
- findExecutable :: ReadFilePathT IO (Maybe FilePath)
- findExecutables :: ReadFilePathT IO [FilePath]
- findExecutablesInDirectories :: [FilePath] -> ReadFilePathT IO [FilePath]
- findFile :: [FilePath] -> ReadFilePathT IO (Maybe FilePath)
- findFiles :: [FilePath] -> ReadFilePathT IO [FilePath]
- findFileWith :: ReadFilePathT IO Bool -> [FilePath] -> ReadFilePathT IO (Maybe FilePath)
- findFilesWith :: ReadFilePathT IO Bool -> [FilePath] -> ReadFilePathT IO [FilePath]
- createFileLink :: FilePath -> ReadFilePathT IO ()
- createDirectoryLink :: FilePath -> ReadFilePathT IO ()
- removeDirectoryLink :: ReadFilePathT IO ()
- pathIsSymbolicLink :: ReadFilePathT IO Bool
- getSymbolicLinkTarget :: ReadFilePathT IO FilePath
- getPermissions :: ReadFilePathT IO Permissions
- setPermissions :: Permissions -> ReadFilePathT IO ()
- copyPermissions :: FilePath -> ReadFilePathT IO ()
- getAccessTime :: ReadFilePathT IO UTCTime
- getModificationTime :: ReadFilePathT IO UTCTime
- setAccessTime :: UTCTime -> ReadFilePathT IO ()
- setModificationTime :: UTCTime -> ReadFilePathT IO ()
- getTemporaryDirectory :: IO FilePath
- getUserDocumentsDirectory :: IO FilePath
- getXdgDirectoryList :: XdgDirectoryList -> IO [FilePath]
- getHomeDirectory :: IO FilePath
- getCurrentDirectory :: IO FilePath
- exeExtension :: String
- setOwnerSearchable :: Bool -> Permissions -> Permissions
- setOwnerExecutable :: Bool -> Permissions -> Permissions
- setOwnerWritable :: Bool -> Permissions -> Permissions
- setOwnerReadable :: Bool -> Permissions -> Permissions
- emptyPermissions :: Permissions
- data Permissions
- data XdgDirectory
- data XdgDirectoryList
Documentation
createDirectory :: ReadFilePathT IO () Source #
createDirectoryIfMissing :: Bool -> ReadFilePathT IO () Source #
removeDirectory :: ReadFilePathT IO () Source #
removePathForcibly :: ReadFilePathT IO () Source #
renameDirectory :: FilePath -> ReadFilePathT IO () Source #
withCurrentDirectory :: IO a -> ReadFilePathT IO a Source #
removeFile :: ReadFilePathT IO () Source #
renameFile :: FilePath -> ReadFilePathT IO () Source #
renamePath :: FilePath -> ReadFilePathT IO () Source #
copyFileWithMetadata :: FilePath -> ReadFilePathT IO () Source #
findFileWith :: ReadFilePathT IO Bool -> [FilePath] -> ReadFilePathT IO (Maybe FilePath) Source #
findFilesWith :: ReadFilePathT IO Bool -> [FilePath] -> ReadFilePathT IO [FilePath] Source #
createFileLink :: FilePath -> ReadFilePathT IO () Source #
createDirectoryLink :: FilePath -> ReadFilePathT IO () Source #
setPermissions :: Permissions -> ReadFilePathT IO () Source #
copyPermissions :: FilePath -> ReadFilePathT IO () Source #
setAccessTime :: UTCTime -> ReadFilePathT IO () Source #
setModificationTime :: UTCTime -> ReadFilePathT IO () Source #
getTemporaryDirectory :: IO FilePath #
Returns the current directory for temporary files.
On Unix, getTemporaryDirectory
returns the value of the TMPDIR
environment variable or "/tmp" if the variable isn't defined.
On Windows, the function checks for the existence of environment variables in
the following order and uses the first path found:
- TMP environment variable.
- TEMP environment variable.
- USERPROFILE environment variable.
- The Windows directory
The operation may fail with:
UnsupportedOperation
The operating system has no notion of temporary directory.
The function doesn't verify whether the path exists.
getUserDocumentsDirectory :: IO FilePath #
Returns the current user's document directory.
The directory returned is expected to be writable by the current user,
but note that it isn't generally considered good practice to store
application-specific data here; use getXdgDirectory
or
getAppUserDataDirectory
instead.
On Unix, getUserDocumentsDirectory
returns the value of the HOME
environment variable. On Windows, the system is queried for a
suitable path; a typical path might be C:/Users/<user>/Documents
.
The operation may fail with:
UnsupportedOperation
The operating system has no notion of document directory.isDoesNotExistError
The document directory for the current user does not exist, or cannot be found.
:: XdgDirectoryList | which special directory list |
-> IO [FilePath] |
Similar to getXdgDirectory
but retrieves the entire list of XDG
directories.
On Windows, XdgDataDirs
and XdgConfigDirs
usually map to the same list
of directories unless overridden.
Refer to the docs of XdgDirectoryList
for more details.
getHomeDirectory :: IO FilePath #
Returns the current user's home directory.
The directory returned is expected to be writable by the current user,
but note that it isn't generally considered good practice to store
application-specific data here; use getXdgDirectory
or
getAppUserDataDirectory
instead.
On Unix, getHomeDirectory
behaves as follows:
- Returns $HOME env variable if set (including to an empty string).
- Otherwise uses home directory returned by
getpwuid_r
using the UID of the current proccesses user. This basically reads the etcpasswd file. An empty home directory field is considered valid.
On Windows, the system is queried for a suitable path; a typical path might be C:/Users/<user>
.
The operation may fail with:
UnsupportedOperation
The operating system has no notion of home directory.isDoesNotExistError
The home directory for the current user does not exist, or cannot be found.
getCurrentDirectory :: IO FilePath #
Obtain the current working directory as an absolute path.
In a multithreaded program, the current working directory is a global state
shared among all threads of the process. Therefore, when performing
filesystem operations from multiple threads, it is highly recommended to
use absolute rather than relative paths (see: makeAbsolute
).
The operation may fail with:
HardwareFault
A physical I/O error has occurred.[EIO]
isDoesNotExistError
There is no path referring to the working directory.[EPERM, ENOENT, ESTALE...]
isPermissionError
The process has insufficient privileges to perform the operation.[EACCES]
isFullError
Insufficient resources are available to perform the operation.UnsupportedOperation
The operating system has no notion of current working directory.
exeExtension :: String #
Filename extension for executable files (including the dot if any)
(usually ""
on POSIX systems and ".exe"
on Windows or OS/2).
Since: directory-1.2.4.0
setOwnerSearchable :: Bool -> Permissions -> Permissions #
setOwnerExecutable :: Bool -> Permissions -> Permissions #
setOwnerWritable :: Bool -> Permissions -> Permissions #
setOwnerReadable :: Bool -> Permissions -> Permissions #
data Permissions #
Instances
Eq Permissions | |
Defined in System.Directory.Internal.Common (==) :: Permissions -> Permissions -> Bool # (/=) :: Permissions -> Permissions -> Bool # | |
Ord Permissions | |
Defined in System.Directory.Internal.Common compare :: Permissions -> Permissions -> Ordering # (<) :: Permissions -> Permissions -> Bool # (<=) :: Permissions -> Permissions -> Bool # (>) :: Permissions -> Permissions -> Bool # (>=) :: Permissions -> Permissions -> Bool # max :: Permissions -> Permissions -> Permissions # min :: Permissions -> Permissions -> Permissions # | |
Read Permissions | |
Defined in System.Directory.Internal.Common readsPrec :: Int -> ReadS Permissions # readList :: ReadS [Permissions] # readPrec :: ReadPrec Permissions # readListPrec :: ReadPrec [Permissions] # | |
Show Permissions | |
Defined in System.Directory.Internal.Common showsPrec :: Int -> Permissions -> ShowS # show :: Permissions -> String # showList :: [Permissions] -> ShowS # |
data XdgDirectory #
Special directories for storing user-specific application data, configuration, and cache files, as specified by the XDG Base Directory Specification.
Note: On Windows, XdgData
and XdgConfig
usually map to the same
directory.
Since: directory-1.2.3.0
XdgData | For data files (e.g. images).
It uses the |
XdgConfig | For configuration files.
It uses the |
XdgCache | For non-essential files (e.g. cache).
It uses the |
Instances
data XdgDirectoryList #
Search paths for various application data, as specified by the XDG Base Directory Specification.
The list of paths is split using searchPathSeparator
,
which on Windows is a semicolon.
Note: On Windows, XdgDataDirs
and XdgConfigDirs
usually yield the same
result.
Since: directory-1.3.2.0
XdgDataDirs | For data files (e.g. images).
It uses the |
XdgConfigDirs | For configuration files.
It uses the |