Copyright | (c) Boris Buliga, 2014 |
---|---|
License | MIT |
Maintainer | d12frosted@icloud.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Redefinition of some functions from System.Directory
module. Some of them have different signature, because they need to work with
. For example, we can't create functions CanonicalPath
createDirectory ::
, because it has no sense. How can we create directory that already exists? Instead we have function CanonicalPath
-> IO ()createDirectory ::
, that creates new directory in base existing directory with provided name. And also it returns CanonicalPath
-> UnsafePath
-> IO CanonicalPath
of newly created directory. Isn't it nice?CanonicalPath
A lot of functions come in two variants: one that returns resulting @CanonicalPath
and second that ignores result (they end with '_' symbol).
Happy Haskell Hacking!
- createDirectory :: MonadIO m => CanonicalPath -> UnsafePath -> m CanonicalPath
- createDirectory_ :: MonadIO m => CanonicalPath -> UnsafePath -> m ()
- createDirectoryIfMissing :: MonadIO m => Bool -> CanonicalPath -> UnsafePath -> m CanonicalPath
- createDirectoryIfMissing_ :: MonadIO m => Bool -> CanonicalPath -> UnsafePath -> m ()
- removeDirectory :: MonadIO m => CanonicalPath -> m ()
- removeDirectoryRecursive :: MonadIO m => CanonicalPath -> m ()
- renameDirectory :: MonadIO m => CanonicalPath -> UnsafePath -> m CanonicalPath
- renameDirectory_ :: MonadIO m => CanonicalPath -> UnsafePath -> m ()
- getDirectoryContents :: MonadIO m => CanonicalPath -> m [UnsafePath]
- getDirectoryContents' :: MonadIO m => CanonicalPath -> m [CanonicalPath]
- getDirectoryContents'' :: MonadIO m => CanonicalPath -> m [Text]
- getCurrentDirectory :: MonadIO m => m CanonicalPath
- setCurrentDirectory :: MonadIO m => CanonicalPath -> m ()
- getHomeDirectory :: MonadIO m => m CanonicalPath
- getAppUserDataDirectory :: MonadIO m => Text -> m UnsafePath
- getUserDocumentsDirectory :: MonadIO m => m CanonicalPath
- getTemporaryDirectory :: MonadIO m => m UnsafePath
- removeFile :: MonadIO m => CanonicalPath -> m ()
- renameFile :: MonadIO m => CanonicalPath -> UnsafePath -> m CanonicalPath
- renameFile_ :: MonadIO m => CanonicalPath -> UnsafePath -> m ()
- copyFile :: MonadIO m => CanonicalPath -> UnsafePath -> m CanonicalPath
- copyFile_ :: MonadIO m => CanonicalPath -> UnsafePath -> m ()
Documentation
:: MonadIO m | |
=> CanonicalPath | base directory |
-> UnsafePath | name of new directory |
-> m CanonicalPath |
|
creates new directory createDirectory
base dirdir
in existing base
directory and returns
of created directory.CanonicalPath
For more information look for documentation of
.createDirectory
Since 0.1.1.0
createDirectory_ :: MonadIO m => CanonicalPath -> UnsafePath -> m () Source
Variant of createDirectory
that ignores resulting CanonicalPath
.
Since 0.2.2.0
createDirectoryIfMissing Source
:: MonadIO m | |
=> Bool | Create its parents too? |
-> CanonicalPath | base directory |
-> UnsafePath | name of new directory |
-> m CanonicalPath |
|
creates a new directory createDirectoryIfMissing
parents dirdir
in base
directory. If the first argument is True
the function will also create all parent directories if they are missing. Function returns
of created directory.CanonicalPath
For more information look for documentation of
.createDirectoryIfMissing
Since 0.1.1.0
createDirectoryIfMissing_ :: MonadIO m => Bool -> CanonicalPath -> UnsafePath -> m () Source
Variant of createDirectoryIfMissing
that ignores resulting CanonicalPath
.
Since 0.2.2.0
removeDirectory :: MonadIO m => CanonicalPath -> m () Source
removes an existing directory dir.removeDirectory
dir
For more information look for documentation of
.removeDirectory
Since 0.1.1.0
removeDirectoryRecursive :: MonadIO m => CanonicalPath -> m () Source
removes an existing directory dir together with its content and all subdirectories. Be careful, if the directory contains symlinks, the function will follow them.removeDirectoryRecursive
dir
For more information look for documentation of
.removeDirectoryRecursive
Since 0.1.1.0
:: MonadIO m | |
=> CanonicalPath | old directory |
-> UnsafePath | new directory (should be just name of directory) |
-> m CanonicalPath |
|
changes the name of an existing directory from old to new and returns renameDirectory
old new
of new directory.CanonicalPath
For more information look for documentation of
.renameDirectory
Since 0.1.1.0
renameDirectory_ :: MonadIO m => CanonicalPath -> UnsafePath -> m () Source
Variant of renameDirectory
that ignores resulting CanonicalPath
.
Since 0.2.2.0
getDirectoryContents :: MonadIO m => CanonicalPath -> m [UnsafePath] Source
returns a list of all entries in dir. If you want to have list of getDirectoryContents
dir
instead use function CanonicalPath
.getDirectoryContents'
For more information look for documentation of
.getDirectoryContents
Since 0.1.1.0
getDirectoryContents' :: MonadIO m => CanonicalPath -> m [CanonicalPath] Source
The same as
, but returns list of getDirectoryContents
instead of CanonicalPath
.UnsafePath
Since 0.1.1.0
getDirectoryContents'' :: MonadIO m => CanonicalPath -> m [Text] Source
The same as
, but returns list of getDirectoryContents
instead of Text
.UnsafePath
Since 0.2.2.0
getCurrentDirectory :: MonadIO m => m CanonicalPath Source
If the operating system has a notion of current directories, getCurrentDirectory
returns an
to the current directory of the calling process.CanonicalPath
For more information look for documentation of
.getCurrentDirectory
Since 0.1.1.0
setCurrentDirectory :: MonadIO m => CanonicalPath -> m () Source
If the operating system has a notion of current directories,
changes the current directory of the calling process to dir.setCurrentDirectory
dir
For more information look for documentation of
.setCurrentDirectory
Since 0.1.1.0
getHomeDirectory :: MonadIO m => m CanonicalPath Source
Returns the current user's home directory.
For more information look for documentation of
.getHomeDirectory
Since 0.1.1.0
getAppUserDataDirectory :: MonadIO m => Text -> m UnsafePath Source
Returns the
of a directory in which application-specific data for the current user can be stored. The result of CanonicalPath
getAppUserDataDirectory
for a given application is specific to the current user.
For more information look for documentation of
.getAppUserDataDirectory
Since 0.1.1.0
getUserDocumentsDirectory :: MonadIO m => m CanonicalPath Source
Returns the current user's document directory.
For more information look for documentation of
.getUserDocumentsDirectory
Since 0.1.1.0
getTemporaryDirectory :: MonadIO m => m UnsafePath Source
Returns the current directory for temporary files.
For more information look for documentation of
.getUserDocumentsDirectorygetTemporaryDirectory
Since 0.1.1.0
removeFile :: MonadIO m => CanonicalPath -> m () Source
removeFile
file removes the directory entry for an existing file file, where file is not itself a directory.
For more information look for documentation of
.removeFile
Since 0.1.1.0
:: MonadIO m | |
=> CanonicalPath |
|
-> UnsafePath | new name of file |
-> m CanonicalPath |
|
changes the name of an existing file system object from old to new.renameFile
old new
For more information look for documentation of
.renameFile
Since 0.1.1.0
renameFile_ :: MonadIO m => CanonicalPath -> UnsafePath -> m () Source
Variant of renameFile
that ignores resulting CanonicalPath
.
Since 0.2.2.0
:: MonadIO m | |
=> CanonicalPath |
|
-> UnsafePath | name of new file (actually it can be path relative to directory of old |
-> m CanonicalPath |
|
copies the existing file from old to new. If the new file already exists, it is atomically replaced by the old file. Neither path may refer to an existing directory. The permissions of old are copied to new, if possible.copyFile
old new
For more information look for documentation of
.copyFile
Since 0.1.1.0
copyFile_ :: MonadIO m => CanonicalPath -> UnsafePath -> m () Source