Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- createDirectory :: Exception e => ReadFilePathT1 e IO
- createDirectoryIfMissing :: Exception e => Bool -> ReadFilePathT1 e IO
- removeDirectory :: Exception e => ReadFilePathT1 e IO
- removeDirectoryRecursive :: Exception e => ReadFilePathT1 e IO
- removePathForcibly :: Exception e => ReadFilePathT1 e IO
- renameDirectory :: Exception e => FilePath -> ReadFilePathT1 e IO
- listDirectory :: Exception e => ReadFilePathT e IO [FilePath]
- getDirectoryContents :: Exception e => ReadFilePathT e IO [FilePath]
- withCurrentDirectory :: Exception e => IO a -> ReadFilePathT e IO a
- getXdgDirectory :: Exception e => XdgDirectory -> ReadFilePathT e IO FilePath
- getAppUserDataDirectory :: Exception e => ReadFilePathT e IO FilePath
- removeFile :: Exception e => ReadFilePathT1 e IO
- renameFile :: Exception e => FilePath -> ReadFilePathT1 e IO
- renamePath :: Exception e => FilePath -> ReadFilePathT1 e IO
- copyFile :: Exception e => FilePath -> ReadFilePathT1 e IO
- copyFileWithMetadata :: Exception e => FilePath -> ReadFilePathT1 e IO
- getFileSize :: Exception e => ReadFilePathT e IO Integer
- canonicalizePath :: Exception e => ReadFilePathT e IO FilePath
- makeAbsolute :: Exception e => ReadFilePathT e IO FilePath
- makeRelativeToCurrentDirectory :: Exception e => ReadFilePathT e IO FilePath
- doesPathExist :: ReadFilePathT e IO Bool
- doesFileExist :: ReadFilePathT e IO Bool
- doesDirectoryExist :: ReadFilePathT e IO Bool
- findExecutable :: ReadFilePathT e IO (Maybe FilePath)
- findExecutables :: ReadFilePathT e IO [FilePath]
- findExecutablesInDirectories :: [FilePath] -> ReadFilePathT e IO [FilePath]
- findFile :: [FilePath] -> ReadFilePathT e IO (Maybe FilePath)
- findFiles :: [FilePath] -> ReadFilePathT e IO [FilePath]
- findFileWith :: ReadFilePathT () IO () -> [FilePath] -> ReadFilePathT () IO FilePath
- findFilesWith :: ReadFilePathT () IO () -> [FilePath] -> ReadFilePathT e' IO [FilePath]
- createFileLink :: Exception e => FilePath -> ReadFilePathT1 e IO
- createDirectoryLink :: Exception e => FilePath -> ReadFilePathT1 e IO
- removeDirectoryLink :: Exception e => ReadFilePathT1 e IO
- pathIsSymbolicLink :: Exception e => ReadFilePathT e IO Bool
- getSymbolicLinkTarget :: Exception e => ReadFilePathT e IO FilePath
- getPermissions :: Exception e => ReadFilePathT e IO Permissions
- setPermissions :: Exception e => Permissions -> ReadFilePathT1 e IO
- copyPermissions :: Exception e => FilePath -> ReadFilePathT1 e IO
- getAccessTime :: Exception e => ReadFilePathT e IO UTCTime
- getModificationTime :: Exception e => ReadFilePathT e IO UTCTime
- setAccessTime :: Exception e => UTCTime -> ReadFilePathT1 e IO
- setModificationTime :: Exception e => UTCTime -> ReadFilePathT1 e 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 :: Exception e => ReadFilePathT1 e IO Source #
createDirectoryIfMissing :: Exception e => Bool -> ReadFilePathT1 e IO Source #
removeDirectory :: Exception e => ReadFilePathT1 e IO Source #
removeDirectoryRecursive :: Exception e => ReadFilePathT1 e IO Source #
removePathForcibly :: Exception e => ReadFilePathT1 e IO Source #
renameDirectory :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
listDirectory :: Exception e => ReadFilePathT e IO [FilePath] Source #
getDirectoryContents :: Exception e => ReadFilePathT e IO [FilePath] Source #
withCurrentDirectory :: Exception e => IO a -> ReadFilePathT e IO a Source #
getXdgDirectory :: Exception e => XdgDirectory -> ReadFilePathT e IO FilePath Source #
getAppUserDataDirectory :: Exception e => ReadFilePathT e IO FilePath Source #
removeFile :: Exception e => ReadFilePathT1 e IO Source #
renameFile :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
renamePath :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
copyFileWithMetadata :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
getFileSize :: Exception e => ReadFilePathT e IO Integer Source #
canonicalizePath :: Exception e => ReadFilePathT e IO FilePath Source #
makeAbsolute :: Exception e => ReadFilePathT e IO FilePath Source #
doesPathExist :: ReadFilePathT e IO Bool Source #
doesFileExist :: ReadFilePathT e IO Bool Source #
findExecutable :: ReadFilePathT e IO (Maybe FilePath) Source #
findExecutables :: ReadFilePathT e IO [FilePath] Source #
findExecutablesInDirectories :: [FilePath] -> ReadFilePathT e IO [FilePath] Source #
findFileWith :: ReadFilePathT () IO () -> [FilePath] -> ReadFilePathT () IO FilePath Source #
findFilesWith :: ReadFilePathT () IO () -> [FilePath] -> ReadFilePathT e' IO [FilePath] Source #
createFileLink :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
createDirectoryLink :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
removeDirectoryLink :: Exception e => ReadFilePathT1 e IO Source #
pathIsSymbolicLink :: Exception e => ReadFilePathT e IO Bool Source #
getSymbolicLinkTarget :: Exception e => ReadFilePathT e IO FilePath Source #
getPermissions :: Exception e => ReadFilePathT e IO Permissions Source #
setPermissions :: Exception e => Permissions -> ReadFilePathT1 e IO Source #
copyPermissions :: Exception e => FilePath -> ReadFilePathT1 e IO Source #
getAccessTime :: Exception e => ReadFilePathT e IO UTCTime Source #
getModificationTime :: Exception e => ReadFilePathT e IO UTCTime Source #
setAccessTime :: Exception e => UTCTime -> ReadFilePathT1 e IO Source #
setModificationTime :: Exception e => UTCTime -> ReadFilePathT1 e 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
).
Note that getCurrentDirectory
is not guaranteed to return the same path
received by setCurrentDirectory
. On POSIX systems, the path returned will
always be fully dereferenced (not contain any symbolic links). For more
information, refer to the documentation of
getcwd.
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
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 # | |
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 # |
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 |
XdgState | For data that should persist between (application) restarts,
but that is not important or portable enough to the user that it
should be stored in Since: directory-1.3.7.0 |
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 |