<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>HPath.IO</title><linkhref="ocean.css"rel="stylesheet"type="text/css"title="Ocean"/><scriptsrc="haddock-util.js"type="text/javascript"></script><scriptsrc="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"type="text/javascript"></script><scripttype="text/javascript">//<![CDATA[
copy, delete, move and so on. It only operates on <em>Path Abs</em> which
guarantees us well-typed paths which are absolute.</p><p>Some functions are just path-safe wrappers around
unix functions, others have stricter exception handling
and some implement functionality that doesn't have a unix
counterpart (like <code><ahref="HPath-IO.html#v:copyDirRecursive">copyDirRecursive</a></code>).</p><p>Some of these operations are due to their nature <strong>not atomic</strong>, which
means they may do multiple syscalls which form one context. Some
of them also have to examine the filetypes explicitly before the
syscalls, so a reasonable decision can be made. That means
the result is undefined if another process changes that context
while the non-atomic operation is still happening. However, where
possible, as few syscalls as possible are used and the underlying
exception handling is kept.</p><p>Note: <code><ahref="HPath-IO.html#v:BlockDevice">BlockDevice</a></code>, <code><ahref="HPath-IO.html#v:CharacterDevice">CharacterDevice</a></code>, <code><ahref="HPath-IO.html#v:NamedPipe">NamedPipe</a></code> and <code><ahref="HPath-IO.html#v:Socket">Socket</a></code>
are ignored by some of the more high-level functions (like <code><ahref="HPath-IO.html#v:easyCopy">easyCopy</a></code>).
For other functions (like <code><ahref="HPath-IO.html#v:copyFile">copyFile</a></code>), the behavior on these file types is
failures will still be raised.</p></div><divclass="subs constructors"><pclass="caption">Constructors</p><table><tr><tdclass="src"><aid="v:FailEarly"class="def">FailEarly</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src"><aid="v:CollectFailures"class="def">CollectFailures</a></td><tdclass="doc empty"> </td></tr></table></div></div><divclass="top"><pclass="src"><spanclass="keyword">data</span><aid="t:CopyMode"class="def">CopyMode</a><ahref="src/HPath-IO.html#CopyMode"class="link">Source</a><ahref="#t:CopyMode"class="selflink">#</a></p><divclass="doc"><p>The mode for copy and file moves.
shortcut.</p></div><divclass="subs constructors"><pclass="caption">Constructors</p><table><tr><tdclass="src"><aid="v:Strict"class="def">Strict</a></td><tdclass="doc"><p>fail if any target exists</p></td></tr><tr><tdclass="src"><aid="v:Overwrite"class="def">Overwrite</a></td><tdclass="doc"><p>overwrite targets</p></td></tr></table></div></div><h1id="g:2">File copying</h1><divclass="top"><pclass="src"><aid="v:copyDirRecursive"class="def">copyDirRecursive</a><ahref="src/HPath-IO.html#copyDirRecursive"class="link">Source</a><ahref="#v:copyDirRecursive"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>source dir</p></td></tr><tr><tdclass="src">-><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>full destination</p></td></tr><tr><tdclass="src">-><ahref="HPath-IO.html#t:CopyMode">CopyMode</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-><ahref="HPath-IO.html#t:RecursiveMode">RecursiveMode</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> ()</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Copies a directory recursively to the given destination.
Does not follow symbolic links.</p><p>For directory contents, this has the same behavior as <code><ahref="HPath-IO.html#v:easyCopy">easyCopy</a></code>
and thus will ignore any file type that is not <code><ahref="HPath-IO.html#v:RegularFile">RegularFile</a></code>,
<code><ahref="HPath-IO.html#v:SymbolicLink">SymbolicLink</a></code> or <code><ahref="HPath-IO.html#v:Directory">Directory</a></code>.</p><p>For <code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode this does not prune destination directory contents,
so the destination might contain more files than the source after
the operation has completed.</p><p>Safety/reliability concerns:</p><ul><li>not atomic</li><li>examines filetypes explicitly</li><li>an explicit check <code><ahref="HPath-IO-Errors.html#v:throwDestinationInSource">throwDestinationInSource</a></code> is carried out for the
carried out recursively (because it's slow)</li></ul><p>Throws:</p><ul><li><code>NoSuchThing</code> if source directory does not exist</li><li><code>PermissionDenied</code> if output directory is not writable</li><li><code>PermissionDenied</code> if source directory can't be opened</li><li><code>InvalidArgument</code> if source directory is wrong type (symlink)</li><li><code>InvalidArgument</code> if source directory is wrong type (regular file)</li><li><code><ahref="HPath-IO-Errors.html#v:SameFile">SameFile</a></code> if source and destination are the same file (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li><li><code><ahref="HPath-IO-Errors.html#v:DestinationInSource">DestinationInSource</a></code> if destination is contained in source (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li><li><code><ahref="HPath-IO-Errors.html#v:RecursiveFailure">RecursiveFailure</a></code> if any sub-operation failed (for <code><ahref="HPath-IO.html#v:CollectFailures">CollectFailures</a></code> RecursiveMode only)</li></ul><p>Throws in <code><ahref="HPath-IO.html#v:Strict">Strict</a></code> CopyMode only:</p><ul><li><code>AlreadyExists</code> if destination already exists</li></ul><p>Throws in <code><ahref="HPath-IO.html#v:CollectFailures">CollectFailures</a></code> RecursiveMode only:</p><ul><li><code>AlreadyExists</code> if destination already exists</li></ul></div></div><divclass="top"><pclass="src"><aid="v:recreateSymlink"class="def">recreateSymlink</a><ahref="src/HPath-IO.html#recreateSymlink"class="link">Source</a><ahref="#v:recreateSymlink"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>the old symlink file</p></td></tr><tr><tdclass="src">-><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>destination file</p></td></tr><tr><tdclass="src">-><ahref="HPath-IO.html#t:CopyMode">CopyMode</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> ()</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Recreate a symlink.</p><p>In <code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode only files and empty directories are deleted.</p><p>Safety/reliability concerns:</p><ul><li><code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode is inherently non-atomic</li></ul><p>Throws:</p><ul><li><code>InvalidArgument</code> if source file is wrong type (not a symlink)</li><li><code>PermissionDenied</code> if output directory cannot be written to</li><li><code>PermissionDenied</code> if source directory cannot be opened</li><li><code>AlreadyExists</code> if destination file already exists (for <code><ahref="HPath-IO.html#v:Strict">Strict</a></code> CopyMode only)</li><li><code><ahref="HPath-IO-Errors.html#v:SameFile">SameFile</a></code> if source and destination are the same file (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li></ul><p>Note: calls <code>symlink</code></p></div></div><divclass="top"><pclass="src"><aid="v:copyFile"class="def">copyFile</a><ahref="src/HPath-IO.html#copyFile"class="link">Source</a><ahref="#v:copyFile"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>source file</p></td></tr><tr><tdclass="src">-><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>destination file</p></td></tr><tr><tdclass="src">-><ahref="HPath-IO.html#t:CopyMode">CopyMode</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO
For "copying" symbolic links, use <code><ahref="HPath-IO.html#v:recreateSymlink">recreateSymlink</a></code> instead.</p><p>Note that this is still sort of a low-level function and doesn't
examine file types. For a more high-level version, use <code><ahref="HPath-IO.html#v:easyCopy">easyCopy</a></code>
instead.</p><p>In <code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode only overwrites actual files, not directories.</p><p>Safety/reliability concerns:</p><ul><li><code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode is not atomic</li><li>when used on <code><ahref="HPath-IO.html#v:CharacterDevice">CharacterDevice</a></code>, reads the "contents" and copies
them to a regular file, which might take indefinitely</li><li>when used on <code><ahref="HPath-IO.html#v:BlockDevice">BlockDevice</a></code>, may either read the "contents"
and copy them to a regular file (potentially hanging indefinitely)
or may create a regular empty destination file</li><li>when used on <code><ahref="HPath-IO.html#v:NamedPipe">NamedPipe</a></code>, will hang indefinitely</li></ul><p>Throws:</p><ul><li><code>NoSuchThing</code> if source file does not exist</li><li><code>NoSuchThing</code> if source file is a a <code><ahref="HPath-IO.html#v:Socket">Socket</a></code></li><li><code>PermissionDenied</code> if output directory is not writable</li><li><code>PermissionDenied</code> if source directory can't be opened</li><li><code>InvalidArgument</code> if source file is wrong type (symlink or directory)</li><li><code>AlreadyExists</code> if destination already exists (for <code><ahref="HPath-IO.html#v:Strict">Strict</a></code> CopyMode only)</li><li><code><ahref="HPath-IO-Errors.html#v:SameFile">SameFile</a></code> if source and destination are the same file (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li></ul><p>Note: calls <code>sendfile</code> and possibly <code><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Text-Read.html#v:read">read</a></code>/<code>write</code> as fallback</p></div></div><divclass="top"><pclass="src"><aid="v:easyCopy"class="def">easyCopy</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="HPath-IO.html#t:CopyMode">CopyMode</a> -><ahref="HPath-IO.html#t:RecursiveMode">RecursiveMode</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#easyCopy"class="link">Source</a><ahref="#v:easyCopy"class="selflink">#</a></p><divclass="doc"><p>Copies a regular file, directory or symbolic link. In case of a
Any other file type is ignored.</p><p>Safety/reliability concerns:</p><ul><li>examines filetypes explicitly</li><li>calls <code><ahref="HPath-IO.html#v:copyDirRecursive">copyDirRecursive</a></code> for directories</li></ul></div></div><h1id="g:3">File deletion</h1><divclass="top"><pclass="src"><aid="v:deleteFile"class="def">deleteFile</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#deleteFile"class="link">Source</a><ahref="#v:deleteFile"class="selflink">#</a></p><divclass="doc"><p>Deletes the given file. Raises <code>eISDIR</code>
if run on a directory. Does not follow symbolic links.</p><p>Throws:</p><ul><li><code>InappropriateType</code> for wrong file type (directory)</li><li><code>NoSuchThing</code> if the file does not exist</li><li><code>PermissionDenied</code> if the directory cannot be read</li></ul></div></div><divclass="top"><pclass="src"><aid="v:deleteDir"class="def">deleteDir</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#deleteDir"class="link">Source</a><ahref="#v:deleteDir"class="selflink">#</a></p><divclass="doc"><p>Deletes the given directory, which must be empty, never symlinks.</p><p>Throws:</p><ul><li><code>InappropriateType</code> for wrong file type (symlink to directory)</li><li><code>InappropriateType</code> for wrong file type (regular file)</li><li><code>NoSuchThing</code> if directory does not exist</li><li><code>UnsatisfiedConstraints</code> if directory is not empty</li><li><code>PermissionDenied</code> if we can't open or write to parent directory</li></ul><p>Notes: calls <code>rmdir</code></p></div></div><divclass="top"><pclass="src"><aid="v:deleteDirRecursive"class="def">deleteDirRecursive</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#deleteDirRecursive"class="link">Source</a><ahref="#v:deleteDirRecursive"class="selflink">#</a></p><divclass="doc"><p>Deletes the given directory recursively. Does not follow symbolic
<code><ahref="HPath-IO.html#v:SymbolicLink">SymbolicLink</a></code> or <code><ahref="HPath-IO.html#v:Directory">Directory</a></code>.</p><p>Safety/reliability concerns:</p><ul><li>not atomic</li><li>examines filetypes explicitly</li></ul><p>Throws:</p><ul><li><code>InappropriateType</code> for wrong file type (symlink to directory)</li><li><code>InappropriateType</code> for wrong file type (regular file)</li><li><code>NoSuchThing</code> if directory does not exist</li><li><code>PermissionDenied</code> if we can't open or write to parent directory</li></ul></div></div><divclass="top"><pclass="src"><aid="v:easyDelete"class="def">easyDelete</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#easyDelete"class="link">Source</a><ahref="#v:easyDelete"class="selflink">#</a></p><divclass="doc"><p>Deletes a file, directory or symlink.
Any other file type is ignored.</p><p>Safety/reliability concerns:</p><ul><li>examines filetypes explicitly</li><li>calls <code><ahref="HPath-IO.html#v:deleteDirRecursive">deleteDirRecursive</a></code> for directories</li></ul></div></div><h1id="g:4">File opening</h1><divclass="top"><pclass="src"><aid="v:openFile"class="def">openFile</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-Posix-Types.html#t:ProcessID">ProcessID</a><ahref="src/HPath-IO.html#openFile"class="link">Source</a><ahref="#v:openFile"class="selflink">#</a></p><divclass="doc"><p>Opens a file appropriately by invoking xdg-open. The file type
is not checked. This forks a process.</p></div></div><divclass="top"><pclass="src"><aid="v:executeFile"class="def">executeFile</a><ahref="src/HPath-IO.html#executeFile"class="link">Source</a><ahref="#v:executeFile"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>program</p></td></tr><tr><tdclass="src">-> [<ahref="https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString.html#t:ByteString">ByteString</a>]</td><tdclass="doc"><p>arguments</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-Posix-Types.html#t:ProcessID">ProcessID</a></td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Executes a program with the given arguments. This forks a process.</p></div></div><h1id="g:5">File creation</h1><divclass="top"><pclass="src"><aid="v:createRegularFile"class="def">createRegularFile</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#createRegularFile"class="link">Source</a><ahref="#v:createRegularFile"class="selflink">#</a></p><divclass="doc"><p>Create an empty regular file at the given directory with the given filename.</p><p>Throws:</p><ul><li><code>PermissionDenied</code> if output directory cannot be written to</li><li><code>AlreadyExists</code> if destination file already exists</li></ul></div></div><divclass="top"><pclass="src"><aid="v:createDir"class="def">createDir</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#createDir"class="link">Source</a><ahref="#v:createDir"class="selflink">#</a></p><divclass="doc"><p>Create an empty directory at the given directory with the given filename.</p><p>Throws:</p><ul><li><code>PermissionDenied</code> if output directory cannot be written to</li><li><code>AlreadyExists</code> if destination directory already exists</li></ul></div></div><divclass="top"><pclass="src"><aid="v:createSymlink"class="def">createSymlink</a><ahref="src/HPath-IO.html#createSymlink"class="link">Source</a><ahref="#v:createSymlink"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>destination file</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString.html#t:ByteString">ByteString</a></td><tdclass="doc"><p>path the symlink points to</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> ()</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Create a symlink.</p><p>Throws:</p><ul><li><code>PermissionDenied</code> if output directory cannot be written to</li><li><code>AlreadyExists</code> if destination file already exists</li></ul><p>Note: calls <code>symlink</code></p></div></div><h1id="g:6">File renaming/moving</h1><divclass="top"><pclass="src"><aid="v:renameFile"class="def">renameFile</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> () <ahref="src/HPath-IO.html#renameFile"class="link">Source</a><ahref="#v:renameFile"class="selflink">#</a></p><divclass="doc"><p>Rename a given file with the provided filename. Destination and source
must be on the same device, otherwise <code><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Foreign-C-Error.html#v:eXDEV">eXDEV</a></code> will be raised.</p><p>Does not follow symbolic links, but renames the symbolic link file.</p><p>Safety/reliability concerns:</p><ul><li>has a separate set of exception handling, apart from the syscall</li></ul><p>Throws:</p><ul><li><code>NoSuchThing</code> if source file does not exist</li><li><code>PermissionDenied</code> if output directory cannot be written to</li><li><code>PermissionDenied</code> if source directory cannot be opened</li><li><code>UnsupportedOperation</code> if source and destination are on different devices</li><li><code><ahref="HPath-IO-Errors.html#v:FileDoesExist">FileDoesExist</a></code> if destination file already exists (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li><li><code><ahref="HPath-IO-Errors.html#v:DirDoesExist">DirDoesExist</a></code> if destination directory already exists (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li><li><code><ahref="HPath-IO-Errors.html#v:SameFile">SameFile</a></code> if destination and source are the same file (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li></ul><p>Note: calls <code><ahref="https://hackage.haskell.org/package/unix-2.7.2.0/docs/System-Posix-Files-ByteString.html#v:rename">rename</a></code> (but does not allow to rename over existing files)</p></div></div><divclass="top"><pclass="src"><aid="v:moveFile"class="def">moveFile</a><ahref="src/HPath-IO.html#moveFile"class="link">Source</a><ahref="#v:moveFile"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>file to move</p></td></tr><tr><tdclass="src">-><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>destination</p></td></tr><tr><tdclass="src">-><ahref="HPath-IO.html#t:CopyMode">CopyMode</a></td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> ()</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Move a file. This also works across devices by copy-delete fallback.
And also works on directories.</p><p>Does not follow symbolic links, but renames the symbolic link file.</p><p>Safety/reliability concerns:</p><ul><li><code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode is not atomic</li><li>copy-delete fallback is inherently non-atomic</li><li>since this function calls <code><ahref="HPath-IO.html#v:easyCopy">easyCopy</a></code> and <code><ahref="HPath-IO.html#v:easyDelete">easyDelete</a></code> as a fallback
to <code><ahref="HPath-IO.html#v:renameFile">renameFile</a></code>, file types that are not <code><ahref="HPath-IO.html#v:RegularFile">RegularFile</a></code>, <code><ahref="HPath-IO.html#v:SymbolicLink">SymbolicLink</a></code>
or <code><ahref="HPath-IO.html#v:Directory">Directory</a></code> may be ignored</li><li>for <code><ahref="HPath-IO.html#v:Overwrite">Overwrite</a></code> mode, the destination will be deleted (not recursively)
before moving</li></ul><p>Throws:</p><ul><li><code>NoSuchThing</code> if source file does not exist</li><li><code>PermissionDenied</code> if output directory cannot be written to</li><li><code>PermissionDenied</code> if source directory cannot be opened</li><li><code><ahref="HPath-IO-Errors.html#v:FileDoesExist">FileDoesExist</a></code> if destination file already exists (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>),
only for <code><ahref="HPath-IO.html#v:Strict">Strict</a></code> CopyMode</li><li><code><ahref="HPath-IO-Errors.html#v:DirDoesExist">DirDoesExist</a></code> if destination directory already exists (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)
only for <code><ahref="HPath-IO.html#v:Strict">Strict</a></code> CopyMode</li><li><code><ahref="HPath-IO-Errors.html#v:SameFile">SameFile</a></code> if destination and source are the same file (<code><ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a></code>)</li></ul><p>Note: calls <code><ahref="https://hackage.haskell.org/package/unix-2.7.2.0/docs/System-Posix-Files-ByteString.html#v:rename">rename</a></code> (but does not allow to rename over existing files)</p></div></div><h1id="g:7">File permissions</h1><divclass="top"><pclass="src"><aid="v:newFilePerms"class="def">newFilePerms</a> :: <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-Posix-Types.html#t:FileMode">FileMode</a><ahref="src/HPath-IO.html#newFilePerms"class="link">Source</a><ahref="#v:newFilePerms"class="selflink">#</a></p><divclass="doc"><p>Default permissions for a new file.</p></div></div><divclass="top"><pclass="src"><aid="v:newDirPerms"class="def">newDirPerms</a> :: <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-Posix-Types.html#t:FileMode">FileMode</a><ahref="src/HPath-IO.html#newDirPerms"class="link">Source</a><ahref="#v:newDirPerms"class="selflink">#</a></p><divclass="doc"><p>Default permissions for a new directory.</p></div></div><h1id="g:8">Directory reading</h1><divclass="top"><pclass="src"><aid="v:getDirsFiles"class="def">getDirsFiles</a><ahref="src/HPath-IO.html#getDirsFiles"class="link">Source</a><ahref="#v:getDirsFiles"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>dir to read</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> [<ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a>]</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Gets all filenames of the given directory. This excludes "." and "..".
This version does not follow symbolic links.</p><p>Throws:</p><ul><li><code>NoSuchThing</code> if directory does not exist</li><li><code>InappropriateType</code> if file type is wrong (file)</li><li><code>InappropriateType</code> if file type is wrong (symlink to file)</li><li><code>InappropriateType</code> if file type is wrong (symlink to dir)</li><li><code>PermissionDenied</code> if directory cannot be opened</li></ul></div></div><h1id="g:9">Filetype operations</h1><divclass="top"><pclass="src"><aid="v:getFileType"class="def">getFileType</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="HPath-IO.html#t:FileType">FileType</a><ahref="src/HPath-IO.html#getFileType"class="link">Source</a><ahref="#v:getFileType"class="selflink">#</a></p><divclass="doc"><p>Get the file type of the file located at the given path. Does
not follow symbolic links.</p><p>Throws:</p><ul><li><code>NoSuchThing</code> if the file does not exist</li><li><code>PermissionDenied</code> if any part of the path is not accessible</li></ul></div></div><h1id="g:10">Others</h1><divclass="top"><pclass="src"><aid="v:canonicalizePath"class="def">canonicalizePath</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> (<ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a>) <ahref="src/HPath-IO.html#canonicalizePath"class="link">Source</a><ahref="#v:canonicalizePath"class="selflink">#</a></p><divclass="doc"><p>Applies <code>realpath</code> on the given absolute path.</p><p>Throws:</p><ul><li><code>NoSuchThing</code> if the file at the given path does not exist</li><li><code>NoSuchThing</code> if the symlink is broken</li></ul></div></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>