Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 2661

ghc-7.4.2-4.mga5.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>System.Directory</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_System-Directory.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">directory-1.1.0.2: library for directory handling</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>stable</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">System.Directory</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Actions on directories
</a></li><li><a href="#g:2">Pre-defined directories
</a></li><li><a href="#g:3">Actions on files
</a></li><li><a href="#g:4">Existence tests
</a></li><li><a href="#g:5">Permissions
</a></li><li><a href="#g:6">Timestamps
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>System-independent interface to directory manipulation.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:createDirectory">createDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:createDirectoryIfMissing">createDirectoryIfMissing</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:removeDirectory">removeDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:removeDirectoryRecursive">removeDirectoryRecursive</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:renameDirectory">renameDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getDirectoryContents">getDirectoryContents</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> [<a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a>]</li><li class="src short"><a href="#v:getCurrentDirectory">getCurrentDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:setCurrentDirectory">setCurrentDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getHomeDirectory">getHomeDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:getAppUserDataDirectory">getAppUserDataDirectory</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:getUserDocumentsDirectory">getUserDocumentsDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:getTemporaryDirectory">getTemporaryDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:removeFile">removeFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:renameFile">renameFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:copyFile">copyFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:canonicalizePath">canonicalizePath</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:makeRelativeToCurrentDirectory">makeRelativeToCurrentDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:findExecutable">findExecutable</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> (<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a>)</li><li class="src short"><a href="#v:doesFileExist">doesFileExist</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:doesDirectoryExist">doesDirectoryExist</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:Permissions">Permissions</a> </li><li class="src short"><a href="#v:emptyPermissions">emptyPermissions</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:readable">readable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:writable">writable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:executable">executable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:searchable">searchable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:setOwnerReadable">setOwnerReadable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:setOwnerWritable">setOwnerWritable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:setOwnerExecutable">setOwnerExecutable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:setOwnerSearchable">setOwnerSearchable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:getPermissions">getPermissions</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="System-Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:setPermissions">setPermissions</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:copyPermissions">copyPermissions</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getModificationTime">getModificationTime</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../old-time-1.1.0.0/System-Time.html#t:ClockTime">ClockTime</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="doc"><p>A directory contains a series of entries, each of which is a named
reference to a file system object (file, directory etc.).  Some
entries may be hidden, inaccessible, or have some administrative
function (e.g. <code><a href="../base-4.5.1.0/Prelude.html#v:.">.</a></code> or `..' under POSIX
<a href="http://www.opengroup.org/onlinepubs/009695399/">http://www.opengroup.org/onlinepubs/009695399/</a>), but in 
this standard all such entries are considered to form part of the
directory contents. Entries in sub-directories are not, however,
considered to form part of the directory contents.
</p><p>Each file system object is referenced by a <em>path</em>.  There is
normally at least one absolute path to each file system object.  In
some operating systems, it may also be possible to have paths which
are relative to the current directory.
</p></div><h1 id="g:1">Actions on directories
</h1><div class="top"><p class="src"><a name="v:createDirectory" class="def">createDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><code><a href="System-Directory.html#v:createDirectory">createDirectory</a></code> dir</code> creates a new directory <code>dir</code> which is
initially empty, or as near to empty as the operating system
allows.
</p><p>The operation may fail with:
</p><ul><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EROFS, EACCES]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isAlreadyExistsError">isAlreadyExistsError</a></code> / <code>AlreadyExists</code>
The operand refers to a directory that already exists.  
<code> [EEXIST]</code>
</li><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code>InvalidArgument</code>
The operand is not a valid directory name.
<code>[ENAMETOOLONG, ELOOP]</code>
</li><li> <code>NoSuchThing</code>
There is no path to the directory. 
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code>ResourceExhausted</code>
Insufficient resources (virtual memory, process file descriptors,
physical disk space, etc.) are available to perform the operation.
<code>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</code>
</li><li> <code>InappropriateType</code>
The path refers to an existing non-directory object.
<code>[EEXIST]</code>
</li></ul></div></div><div class="top"><p class="src"><a name="v:createDirectoryIfMissing" class="def">createDirectoryIfMissing</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p>Create its parents too?
</p></td></tr><tr><td class="src">-&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>The path to the directory you want to make
</p></td></tr><tr><td class="src">-&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p><code><code><a href="System-Directory.html#v:createDirectoryIfMissing">createDirectoryIfMissing</a></code> parents dir</code> creates a new directory 
 <code>dir</code> if it doesn't exist. If the first argument is <code><a href="../base-4.5.1.0/Data-Bool.html#v:True">True</a></code>
 the function will also create all parent directories if they are missing.
</p></div></div><div class="top"><p class="src"><a name="v:removeDirectory" class="def">removeDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><code><a href="System-Directory.html#v:removeDirectory">removeDirectory</a></code> dir</code> removes an existing directory <em>dir</em>.  The
implementation may specify additional constraints which must be
satisfied before a directory can be removed (e.g. the directory has to
be empty, or may not be in use by other processes).  It is not legal
for an implementation to partially remove a directory unless the
entire directory is removed. A conformant implementation need not
support directory removal in all situations (e.g. removal of the root
directory).
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
EIO
</li><li> <code>InvalidArgument</code>
The operand is not a valid directory name.
[ENAMETOOLONG, ELOOP]
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
The directory does not exist. 
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EROFS, EACCES, EPERM]</code>
</li><li> <code>UnsatisfiedConstraints</code>
Implementation-dependent constraints are not satisfied.  
<code>[EBUSY, ENOTEMPTY, EEXIST]</code>
</li><li> <code>UnsupportedOperation</code>
The implementation does not support removal in this situation.
<code>[EINVAL]</code>
</li><li> <code>InappropriateType</code>
The operand refers to an existing non-directory object.
<code>[ENOTDIR]</code>
</li></ul></div></div><div class="top"><p class="src"><a name="v:removeDirectoryRecursive" class="def">removeDirectoryRecursive</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><code><a href="System-Directory.html#v:removeDirectoryRecursive">removeDirectoryRecursive</a></code> dir</code>  removes an existing directory <em>dir</em>
 together with its content and all subdirectories. Be careful, 
 if the directory contains symlinks, the function will follow them.
</p></div></div><div class="top"><p class="src"><a name="v:renameDirectory" class="def">renameDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><code><a href="System-Directory.html#v:renameDirectory">renameDirectory</a></code> old new</code> changes the name of an existing
directory from <em>old</em> to <em>new</em>.  If the <em>new</em> directory
already exists, it is atomically replaced by the <em>old</em> directory.
If the <em>new</em> directory is neither the <em>old</em> directory nor an
alias of the <em>old</em> directory, it is removed as if by
<code><a href="System-Directory.html#v:removeDirectory">removeDirectory</a></code>.  A conformant implementation need not support
renaming directories in all situations (e.g. renaming to an existing
directory, or across different physical devices), but the constraints
must be documented.
</p><p>On Win32 platforms, <code>renameDirectory</code> fails if the <em>new</em> directory already
exists.
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code>InvalidArgument</code>
Either operand is not a valid directory name.
<code>[ENAMETOOLONG, ELOOP]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
The original directory does not exist, or there is no path to the target.
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EROFS, EACCES, EPERM]</code>
</li><li> <code>ResourceExhausted</code>
Insufficient resources are available to perform the operation.  
<code>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</code>
</li><li> <code>UnsatisfiedConstraints</code>
Implementation-dependent constraints are not satisfied.
<code>[EBUSY, ENOTEMPTY, EEXIST]</code>
</li><li> <code>UnsupportedOperation</code>
The implementation does not support renaming in this situation.
<code>[EINVAL, EXDEV]</code>
</li><li> <code>InappropriateType</code>
Either path refers to an existing non-directory object.
<code>[ENOTDIR, EISDIR]</code>
</li></ul></div></div><div class="top"><p class="src"><a name="v:getDirectoryContents" class="def">getDirectoryContents</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> [<a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a>]</p><div class="doc"><p><code><code><a href="System-Directory.html#v:getDirectoryContents">getDirectoryContents</a></code> dir</code> returns a list of <em>all</em> entries
in <em>dir</em>. 
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code>InvalidArgument</code>
The operand is not a valid directory name.
<code>[ENAMETOOLONG, ELOOP]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
The directory does not exist.
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EACCES]</code>
</li><li> <code>ResourceExhausted</code>
Insufficient resources are available to perform the operation.
<code>[EMFILE, ENFILE]</code>
</li><li> <code>InappropriateType</code>
The path refers to an existing non-directory object.
<code>[ENOTDIR]</code>
</li></ul></div></div><div class="top"><p class="src"><a name="v:getCurrentDirectory" class="def">getCurrentDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p>If the operating system has a notion of current directories,
<code><a href="System-Directory.html#v:getCurrentDirectory">getCurrentDirectory</a></code> returns an absolute path to the
current directory of the calling process.
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
There is no path referring to the current directory.
<code>[EPERM, ENOENT, ESTALE...]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EACCES]</code>
</li><li> <code>ResourceExhausted</code>
Insufficient resources are available to perform the operation.
</li><li> <code>UnsupportedOperation</code>
The operating system has no notion of current directory.
</li></ul><p>Note that in a concurrent program, the current directory is global
state shared between all threads of the process.  When using
filesystem operations from multiple threads, it is therefore highly
recommended to use absolute rather than relative <code><a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></code>s.
</p></div></div><div class="top"><p class="src"><a name="v:setCurrentDirectory" class="def">setCurrentDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>If the operating system has a notion of current directories,
<code><code><a href="System-Directory.html#v:setCurrentDirectory">setCurrentDirectory</a></code> dir</code> changes the current
directory of the calling process to <em>dir</em>.
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code>InvalidArgument</code>
The operand is not a valid directory name.
<code>[ENAMETOOLONG, ELOOP]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
The directory does not exist.
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EACCES]</code>
</li><li> <code>UnsupportedOperation</code>
The operating system has no notion of current directory, or the
current directory cannot be dynamically changed.
</li><li> <code>InappropriateType</code>
The path refers to an existing non-directory object.
<code>[ENOTDIR]</code>
</li></ul><p>Note that in a concurrent program, the current directory is global
state shared between all threads of the process.  When using
filesystem operations from multiple threads, it is therefore highly
recommended to use absolute rather than relative <code><a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></code>s.
</p></div></div><h1 id="g:2">Pre-defined directories
</h1><div class="top"><p class="src"><a name="v:getHomeDirectory" class="def">getHomeDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p>Returns the current user's home directory.
</p><p>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 <code><a href="System-Directory.html#v:getAppUserDataDirectory">getAppUserDataDirectory</a></code>
instead.
</p><p>On Unix, <code><a href="System-Directory.html#v:getHomeDirectory">getHomeDirectory</a></code> returns the value of the <code>HOME</code>
environment variable.  On Windows, the system is queried for a
suitable path; a typical path might be 
<code>C:<em>Documents And Settings</em>user</code>.
</p><p>The operation may fail with:
</p><ul><li> <code>UnsupportedOperation</code>
The operating system has no notion of home directory.
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code>
The home directory for the current user does not exist, or
cannot be found.
</li></ul></div></div><div class="top"><p class="src"><a name="v:getAppUserDataDirectory" class="def">getAppUserDataDirectory</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p>Returns the pathname of a directory in which application-specific
data for the current user can be stored.  The result of
<code><a href="System-Directory.html#v:getAppUserDataDirectory">getAppUserDataDirectory</a></code> for a given application is specific to
the current user.
</p><p>The argument should be the name of the application, which will be used
to construct the pathname (so avoid using unusual characters that
might result in an invalid pathname).
</p><p>Note: the directory may not actually exist, and may need to be created
first.  It is expected that the parent directory exists and is
writable.
</p><p>On Unix, this function returns <code>$HOME/.appName</code>.  On Windows, a
typical path might be 
</p><pre> C:/Documents And Settings/user/Application Data/appName
</pre><p>The operation may fail with:
</p><ul><li> <code>UnsupportedOperation</code>
The operating system has no notion of application-specific data directory.
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code>
The home directory for the current user does not exist, or
cannot be found.
</li></ul></div></div><div class="top"><p class="src"><a name="v:getUserDocumentsDirectory" class="def">getUserDocumentsDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p>Returns the current user's document directory.
</p><p>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 <code><a href="System-Directory.html#v:getAppUserDataDirectory">getAppUserDataDirectory</a></code>
instead.
</p><p>On Unix, <code><a href="System-Directory.html#v:getUserDocumentsDirectory">getUserDocumentsDirectory</a></code> returns the value of the <code>HOME</code>
environment variable.  On Windows, the system is queried for a
suitable path; a typical path might be 
<code>C:/Documents and Settings/user/My Documents</code>.
</p><p>The operation may fail with:
</p><ul><li> <code>UnsupportedOperation</code>
The operating system has no notion of document directory.
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code>
The document directory for the current user does not exist, or
cannot be found.
</li></ul></div></div><div class="top"><p class="src"><a name="v:getTemporaryDirectory" class="def">getTemporaryDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p>Returns the current directory for temporary files.
</p><p>On Unix, <code><a href="System-Directory.html#v:getTemporaryDirectory">getTemporaryDirectory</a></code> returns the value of the <code>TMPDIR</code>
environment variable or &quot;/tmp&quot; 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:
</p><ul><li> 
TMP environment variable. 
</li><li>
TEMP environment variable. 
</li><li>
USERPROFILE environment variable. 
</li><li>
The Windows directory
</li></ul><p>The operation may fail with:
</p><ul><li> <code>UnsupportedOperation</code>
The operating system has no notion of temporary directory.
</li></ul><p>The function doesn't verify whether the path exists.
</p></div></div><h1 id="g:3">Actions on files
</h1><div class="top"><p class="src"><a name="v:removeFile" class="def">removeFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><a href="System-Directory.html#v:removeFile">removeFile</a></code> <em>file</em> removes the directory entry for an existing file
<em>file</em>, where <em>file</em> is not itself a directory. The
implementation may specify additional constraints which must be
satisfied before a file can be removed (e.g. the file may not be in
use by other processes).
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code>InvalidArgument</code>
The operand is not a valid file name.
<code>[ENAMETOOLONG, ELOOP]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
The file does not exist. 
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EROFS, EACCES, EPERM]</code>
</li><li> <code>UnsatisfiedConstraints</code>
Implementation-dependent constraints are not satisfied.  
<code>[EBUSY]</code>
</li><li> <code>InappropriateType</code>
The operand refers to an existing directory.
<code>[EPERM, EINVAL]</code>
</li></ul></div></div><div class="top"><p class="src"><a name="v:renameFile" class="def">renameFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><code><a href="System-Directory.html#v:renameFile">renameFile</a></code> old new</code> changes the name of an existing file system
object from <em>old</em> to <em>new</em>.  If the <em>new</em> object already
exists, it is atomically replaced by the <em>old</em> object.  Neither
path may refer to an existing directory.  A conformant implementation
need not support renaming files in all situations (e.g. renaming
across different physical devices), but the constraints must be
documented.
</p><p>The operation may fail with:
</p><ul><li> <code>HardwareFault</code>
A physical I/O error has occurred.
<code>[EIO]</code>
</li><li> <code>InvalidArgument</code>
Either operand is not a valid file name.
<code>[ENAMETOOLONG, ELOOP]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code>
The original file does not exist, or there is no path to the target.
<code>[ENOENT, ENOTDIR]</code>
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code>
The process has insufficient privileges to perform the operation.
<code>[EROFS, EACCES, EPERM]</code>
</li><li> <code>ResourceExhausted</code>
Insufficient resources are available to perform the operation.  
<code>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</code>
</li><li> <code>UnsatisfiedConstraints</code>
Implementation-dependent constraints are not satisfied.
<code>[EBUSY]</code>
</li><li> <code>UnsupportedOperation</code>
The implementation does not support renaming in this situation.
<code>[EXDEV]</code>
</li><li> <code>InappropriateType</code>
Either path refers to an existing directory.
<code>[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]</code>
</li></ul></div></div><div class="top"><p class="src"><a name="v:copyFile" class="def">copyFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p><code><code><a href="System-Directory.html#v:copyFile">copyFile</a></code> old new</code> copies the existing file from <em>old</em> to <em>new</em>.
If the <em>new</em> file already exists, it is atomically replaced by the <em>old</em> file.
Neither path may refer to an existing directory.  The permissions of <em>old</em> are
copied to <em>new</em>, if possible.
</p></div></div><div class="top"><p class="src"><a name="v:canonicalizePath" class="def">canonicalizePath</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p>Given path referring to a file or directory, returns a
 canonicalized path, with the intent that two paths referring
 to the same file/directory will map to the same canonicalized
 path. Note that it is impossible to guarantee that the
 implication (same file/dir &lt;=&gt; same canonicalizedPath) holds
 in either direction: this function can make only a best-effort
 attempt.
</p></div></div><div class="top"><p class="src"><a name="v:makeRelativeToCurrentDirectory" class="def">makeRelativeToCurrentDirectory</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a></p><div class="doc"><p><code><a href="../filepath-1.3.0.0/System-FilePath-Posix.html#v:makeRelative">makeRelative</a></code> the current directory.
</p></div></div><div class="top"><p class="src"><a name="v:findExecutable" class="def">findExecutable</a> :: <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> (<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a>)</p><div class="doc"><p>Given an executable file name, searches for such file in the
 directories listed in system PATH. The returned value is the path
 to the found executable or Nothing if an executable with the given
 name was not found. For example (findExecutable &quot;ghc&quot;) gives you
 the path to GHC.
</p><p>The path returned by <code><a href="System-Directory.html#v:findExecutable">findExecutable</a></code> corresponds to the
 program that would be executed by <code><a href="System-Process.html#v:createProcess">createProcess</a></code>
 when passed the same string (as a RawCommand, not a ShellCommand).
</p><p>On Windows, <code><a href="System-Directory.html#v:findExecutable">findExecutable</a></code> calls the Win32 function <code>SearchPath</code>,
 which may search other places before checking the directories in
 <code>PATH</code>.  Where it actually searches depends on registry settings,
 but notably includes the directory containing the current
 executable. See
 <a href="http://msdn.microsoft.com/en-us/library/aa365527.aspx">http://msdn.microsoft.com/en-us/library/aa365527.aspx</a> for more
 details.  
</p></div></div><h1 id="g:4">Existence tests
</h1><div class="top"><p class="src"><a name="v:doesFileExist" class="def">doesFileExist</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>The operation <code><a href="System-Directory.html#v:doesFileExist">doesFileExist</a></code> returns <code><a href="../base-4.5.1.0/Data-Bool.html#v:True">True</a></code>
if the argument file exists and is not a directory, and <code><a href="../base-4.5.1.0/Data-Bool.html#v:False">False</a></code> otherwise.
</p></div></div><div class="top"><p class="src"><a name="v:doesDirectoryExist" class="def">doesDirectoryExist</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>The operation <code><a href="System-Directory.html#v:doesDirectoryExist">doesDirectoryExist</a></code> returns <code><a href="../base-4.5.1.0/Data-Bool.html#v:True">True</a></code> if the argument file
exists and is a directory, and <code><a href="../base-4.5.1.0/Data-Bool.html#v:False">False</a></code> otherwise.
</p></div></div><h1 id="g:5">Permissions
</h1><div class="doc"><p>The <code><a href="System-Directory.html#t:Permissions">Permissions</a></code> type is used to record whether certain operations are
 permissible on a file/directory. <code><a href="System-Directory.html#v:getPermissions">getPermissions</a></code> and <code><a href="System-Directory.html#v:setPermissions">setPermissions</a></code>
 get and set these permissions, respectively. Permissions apply both to
 files and directories. For directories, the executable field will be
 <code><a href="../base-4.5.1.0/Data-Bool.html#v:False">False</a></code>, and for files the searchable field will be <code><a href="../base-4.5.1.0/Data-Bool.html#v:False">False</a></code>. Note that
 directories may be searchable without being readable, if permission has
 been given to use them as part of a path, but not to examine the 
 directory contents.
</p><p>Note that to change some, but not all permissions, a construct on the following lines must be used. 
</p><pre>  makeReadable f = do
     p &lt;- getPermissions f
     setPermissions f (p {readable = True})
</pre></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Permissions" class="def">Permissions</a>  </p><div class="subs instances"><p id="control.i:Permissions" class="caption collapser" onclick="toggleSection('i:Permissions')">Instances</p><div id="section.i:Permissions" class="show"><table><tr><td class="src"><a href="../base-4.5.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="System-Directory.html#t:Permissions">Permissions</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="../base-4.5.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="System-Directory.html#t:Permissions">Permissions</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="../base-4.5.1.0/Text-Read.html#t:Read">Read</a> <a href="System-Directory.html#t:Permissions">Permissions</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="../base-4.5.1.0/Text-Show.html#t:Show">Show</a> <a href="System-Directory.html#t:Permissions">Permissions</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:emptyPermissions" class="def">emptyPermissions</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a></p></div><div class="top"><p class="src"><a name="v:readable" class="def">readable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p></div><div class="top"><p class="src"><a name="v:writable" class="def">writable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p></div><div class="top"><p class="src"><a name="v:executable" class="def">executable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p></div><div class="top"><p class="src"><a name="v:searchable" class="def">searchable</a> :: <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p></div><div class="top"><p class="src"><a name="v:setOwnerReadable" class="def">setOwnerReadable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></p></div><div class="top"><p class="src"><a name="v:setOwnerWritable" class="def">setOwnerWritable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></p></div><div class="top"><p class="src"><a name="v:setOwnerExecutable" class="def">setOwnerExecutable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></p></div><div class="top"><p class="src"><a name="v:setOwnerSearchable" class="def">setOwnerSearchable</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a></p></div><div class="top"><p class="src"><a name="v:getPermissions" class="def">getPermissions</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="System-Directory.html#t:Permissions">Permissions</a></p><div class="doc"><p>The <code><a href="System-Directory.html#v:getPermissions">getPermissions</a></code> operation returns the
permissions for the file or directory.
</p><p>The operation may fail with:
</p><ul><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> if the user is not permitted to access
  the permissions; or
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> if the file or directory does not exist.
</li></ul></div></div><div class="top"><p class="src"><a name="v:setPermissions" class="def">setPermissions</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="System-Directory.html#t:Permissions">Permissions</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>The <code><a href="System-Directory.html#v:setPermissions">setPermissions</a></code> operation sets the
permissions for the file or directory.
</p><p>The operation may fail with:
</p><ul><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> if the user is not permitted to set
  the permissions; or
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> if the file or directory does not exist.
</li></ul></div></div><div class="top"><p class="src"><a name="v:copyPermissions" class="def">copyPermissions</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p></div><h1 id="g:6">Timestamps
</h1><div class="top"><p class="src"><a name="v:getModificationTime" class="def">getModificationTime</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -&gt; <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../old-time-1.1.0.0/System-Time.html#t:ClockTime">ClockTime</a></p><div class="doc"><p>The <code><a href="System-Directory.html#v:getModificationTime">getModificationTime</a></code> operation returns the
clock time at which the file or directory was last modified.
</p><p>The operation may fail with:
</p><ul><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isPermissionError">isPermissionError</a></code> if the user is not permitted to access
  the modification time; or
</li><li> <code><a href="../base-4.5.1.0/System-IO-Error.html#v:isDoesNotExistError">isDoesNotExistError</a></code> if the file or directory does not exist.
</li></ul></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>