29 lines
15 KiB
HTML
29 lines
15 KiB
HTML
<!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.Path</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-Path.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">MissingH-1.3.0.1: Large utility library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2004-2011 John Goerzen</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>John Goerzen <jgoerzen@complete.org></td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">System.Path</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Name processing</a></li><li><a href="#g:2">Directory Processing</a></li><li><a href="#g:3">Temporary Directories</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module provides various helpful utilities for dealing with path and
|
|
file names, directories, and related support.</p><p>Written by John Goerzen, jgoerzen@complete.org</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:splitExt">splitExt</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:absNormPath">absNormPath</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:secureAbsNormPath">secureAbsNormPath</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:recurseDir">recurseDir</a> :: <a href="System-IO-HVFS.html#t:HVFS">HVFS</a> a => a -> <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> [<a href="System-IO-HVFS.html#t:FilePath">FilePath</a>]</li><li class="src short"><a href="#v:recurseDirStat">recurseDirStat</a> :: <a href="System-IO-HVFS.html#t:HVFS">HVFS</a> a => a -> <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> [(<a href="System-IO-HVFS.html#t:FilePath">FilePath</a>, <a href="System-IO-HVFS.html#t:HVFSStatEncap">HVFSStatEncap</a>)]</li><li class="src short"><a href="#v:recursiveRemove">recursiveRemove</a> :: <a href="System-IO-HVFS.html#t:HVFS">HVFS</a> a => a -> <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:bracketCWD">bracketCWD</a> :: <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:mktmpdir">mktmpdir</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:brackettmpdir">brackettmpdir</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:brackettmpdirCWD">brackettmpdirCWD</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a</li></ul></div><div id="interface"><h1 id="g:1">Name processing</h1><div class="top"><p class="src"><a name="v:splitExt" class="def">splitExt</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</p><div class="doc"><p>Splits a pathname into a tuple representing the root of the name and
|
|
the extension. The extension is considered to be all characters from the last
|
|
dot after the last slash to the end. Either returned string may be empty. </p></div></div><div class="top"><p class="src"><a name="v:absNormPath" class="def">absNormPath</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Absolute path for use with starting directory</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path name to make absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Result</p></td></tr></table></div><div class="doc"><p>Make an absolute, normalized version of a path with all double slashes,
|
|
dot, and dotdot entries removed.</p><p>The first parameter is the base for the absolut calculation; in many cases,
|
|
it would correspond to the current working directory.</p><p>The second parameter is the pathname to transform. If it is already absolute,
|
|
the first parameter is ignored.</p><p>Nothing may be returned if there's an error; for instance, too many <code>..</code> entries
|
|
for the given path.</p></div></div><div class="top"><p class="src"><a name="v:secureAbsNormPath" class="def">secureAbsNormPath</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Absolute path for use with starting directory</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path to make absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Like absNormPath, but returns Nothing if the generated result is not
|
|
the passed base path or a subdirectory thereof. </p></div></div><h1 id="g:2">Directory Processing</h1><div class="top"><p class="src"><a name="v:recurseDir" class="def">recurseDir</a> :: <a href="System-IO-HVFS.html#t:HVFS">HVFS</a> a => a -> <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> [<a href="System-IO-HVFS.html#t:FilePath">FilePath</a>]</p><div class="doc"><p>Obtain a recursive listing of all files/directories beneath
|
|
the specified directory. The traversal is depth-first
|
|
and the original
|
|
item is always present in the returned list.</p><p>If the passed value is not a directory, the return value
|
|
be only that value.</p><p>The "." and ".." entries are removed from the data returned.</p></div></div><div class="top"><p class="src"><a name="v:recurseDirStat" class="def">recurseDirStat</a> :: <a href="System-IO-HVFS.html#t:HVFS">HVFS</a> a => a -> <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> [(<a href="System-IO-HVFS.html#t:FilePath">FilePath</a>, <a href="System-IO-HVFS.html#t:HVFSStatEncap">HVFSStatEncap</a>)]</p><div class="doc"><p>Like <code><a href="System-Path.html#v:recurseDir">recurseDir</a></code>, but return the stat() (System.Posix.Files.FileStatus)
|
|
information with them. This is an optimization if you will be statting files
|
|
yourself later.</p><p>The items are returned lazily.</p><p>WARNING: do not change your current working directory until you have consumed
|
|
all the items. Doing so could cause strange effects.</p><p>Alternatively, you may wish to pass an absolute path to this function.</p></div></div><div class="top"><p class="src"><a name="v:recursiveRemove" class="def">recursiveRemove</a> :: <a href="System-IO-HVFS.html#t:HVFS">HVFS</a> a => a -> <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Removes a file or a directory. If a directory, also removes all its
|
|
child files/directories.</p></div></div><div class="top"><p class="src"><a name="v:bracketCWD" class="def">bracketCWD</a> :: <a href="System-IO-HVFS.html#t:FilePath">FilePath</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>Changes the current working directory to the given path,
|
|
executes the given I/O action, then changes back to the original directory,
|
|
even if the I/O action raised an exception. </p></div></div><h1 id="g:3">Temporary Directories</h1><div class="top"><p class="src"><a name="v:mktmpdir" class="def">mktmpdir</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Creates a temporary directory for your use.</p><p>The passed string should be a template suitable for mkstemp; that is, end with
|
|
<code>"XXXXXX"</code>.</p><p>Your string should probably start with the value returned from
|
|
System.Directory.getTemporaryDirectory.</p><p>The name of the directory created will be returned.</p></div></div><div class="top"><p class="src"><a name="v:brackettmpdir" class="def">brackettmpdir</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>Creates a temporary directory for your use via <code><a href="System-Path.html#v:mktmpdir">mktmpdir</a></code>,
|
|
runs the specified action (passing in the directory name), then
|
|
removes the directory and all its contents when the action completes (or raises
|
|
an exception. </p></div></div><div class="top"><p class="src"><a name="v:brackettmpdirCWD" class="def">brackettmpdirCWD</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>Runs the given I/O action with the CWD set to the given tmp dir,
|
|
removing the tmp dir and changing CWD back afterwards, even if there
|
|
was an exception. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html> |