Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
Deprecated alias for Filesystem.
- isFile :: FilePath -> IO Bool
- isDirectory :: FilePath -> IO Bool
- rename :: FilePath -> FilePath -> IO ()
- canonicalizePath :: FilePath -> IO FilePath
- listDirectory :: FilePath -> IO [FilePath]
- createDirectory :: Bool -> FilePath -> IO ()
- createTree :: FilePath -> IO ()
- removeFile :: FilePath -> IO ()
- removeDirectory :: FilePath -> IO ()
- removeTree :: FilePath -> IO ()
- getWorkingDirectory :: IO FilePath
- setWorkingDirectory :: FilePath -> IO ()
- getHomeDirectory :: IO FilePath
- getDesktopDirectory :: IO FilePath
- getDocumentsDirectory :: IO FilePath
- getAppDataDirectory :: Text -> IO FilePath
- getAppCacheDirectory :: Text -> IO FilePath
- getAppConfigDirectory :: Text -> IO FilePath
Generic operations
isDirectory :: FilePath -> IO BoolSource
Check if a directory exists at the given path.
See: doesDirectoryExist
rename :: FilePath -> FilePath -> IO ()Source
Rename a filesystem object. Some operating systems have restrictions on what objects can be renamed; see linked documentation for details.
See: renameFile
and renameDirectory
listDirectory :: FilePath -> IO [FilePath]Source
List contents of a directory, excluding "."
and ".."
. Each
returned FilePath
includes the path of the directory.
See: getDirectoryContents
Creating things
Create a directory at a given path. The user may choose whether it is an error for a directory to already exist at that path.
See: createDirectory
.
createTree :: FilePath -> IO ()Source
Create a directory at a given path, including any parents which might be missing.
Removing things
removeFile :: FilePath -> IO ()Source
Remove a file.
See: removeFile
removeDirectory :: FilePath -> IO ()Source
Remove an empty directory.
See: removeDirectory
removeTree :: FilePath -> IO ()Source
Recursively remove a directory tree rooted at the given path.
Current working directory
getWorkingDirectory :: IO FilePathSource
Get the current working directory.
See: getCurrentDirectory
setWorkingDirectory :: FilePath -> IO ()Source
Set the current working directory.
See: setCurrentDirectory
Commonly used paths
getHomeDirectory :: IO FilePathSource
Get the user’s home directory. This is useful for building paths to more specific directories.
For directing the user to open or safe a document, use
getDocumentsDirectory
.
For data files the user does not explicitly create, such as automatic
saves, use getAppDataDirectory
.
See: getHomeDirectory
getDesktopDirectory :: IO FilePathSource
Get the user’s home directory. This is a good starting point for
file dialogs and other user queries. For data files the user does not
explicitly create, such as automatic saves, use getAppDataDirectory
.
getDocumentsDirectory :: IO FilePathSource
Get the user’s documents directory. This is a good place to save
user-created files. For data files the user does not explicitly create,
such as automatic saves, use getAppDataDirectory
.
getAppDataDirectory :: Text -> IO FilePathSource
Get the user’s application data directory, given an application label. This directory is where applications should store data the user did not explicitly create, such as databases and automatic saves.
getAppCacheDirectory :: Text -> IO FilePathSource
Get the user’s application cache directory, given an application label. This directory is where applications should store caches, which might be large and can be safely deleted.
getAppConfigDirectory :: Text -> IO FilePathSource
Get the user’s application configuration directory, given an application label. This directory is where applications should store their configurations and settings.