<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >System.Path</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_System-Path.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >MissingH-1.1.0.3: Large utility library</TD ><TD CLASS="topbut" ><A HREF="src/System-Path.html" >Source code</A ></TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >System.Path</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >provisional</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >John Goerzen <jgoerzen@complete.org></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Name processing </A ></DT ><DT ><A HREF="#2" >Directory Processing </A ></DT ><DT ><A HREF="#3" >Temporary Directories </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3AsplitExt" >splitExt</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AabsNormPath" >absNormPath</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsecureAbsNormPath" >secureAbsNormPath</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArecurseDir" >recurseDir</A > :: <A HREF="System-IO-HVFS.html#t%3AHVFS" >HVFS</A > a => a -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [<A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArecurseDirStat" >recurseDirStat</A > :: <A HREF="System-IO-HVFS.html#t%3AHVFS" >HVFS</A > a => a -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [(<A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A >, <A HREF="System-IO-HVFS.html#t%3AHVFSStatEncap" >HVFSStatEncap</A >)]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArecursiveRemove" >recursiveRemove</A > :: <A HREF="System-IO-HVFS.html#t%3AHVFS" >HVFS</A > a => a -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AbracketCWD" >bracketCWD</A > :: <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Amktmpdir" >mktmpdir</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Abrackettmpdir" >brackettmpdir</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AbrackettmpdirCWD" >brackettmpdirCWD</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Name processing </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:splitExt" ><A NAME="v%3AsplitExt" ></A ></A ><B >splitExt</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >)</TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#splitExt" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >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. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:absNormPath" ><A NAME="v%3AabsNormPath" ></A ></A ><B >absNormPath</B ></TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#absNormPath" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" >Absolute path for use with starting directory </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" >The path name to make absolute </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" >Result </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><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 <TT >..</TT > entries for the given path. </P ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:secureAbsNormPath" ><A NAME="v%3AsecureAbsNormPath" ></A ></A ><B >secureAbsNormPath</B ></TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#secureAbsNormPath" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" >Absolute path for use with starting directory </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" >The path to make absolute </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" >Like absNormPath, but returns Nothing if the generated result is not the passed base path or a subdirectory thereof. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >Directory Processing </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:recurseDir" ><A NAME="v%3ArecurseDir" ></A ></A ><B >recurseDir</B > :: <A HREF="System-IO-HVFS.html#t%3AHVFS" >HVFS</A > a => a -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [<A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A >]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-HVFS-Utils.html#recurseDir" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:recurseDirStat" ><A NAME="v%3ArecurseDirStat" ></A ></A ><B >recurseDirStat</B > :: <A HREF="System-IO-HVFS.html#t%3AHVFS" >HVFS</A > a => a -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [(<A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A >, <A HREF="System-IO-HVFS.html#t%3AHVFSStatEncap" >HVFSStatEncap</A >)]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-HVFS-Utils.html#recurseDirStat" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >Like <TT ><A HREF="System-Path.html#v%3ArecurseDir" >recurseDir</A ></TT >, 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:recursiveRemove" ><A NAME="v%3ArecursiveRemove" ></A ></A ><B >recursiveRemove</B > :: <A HREF="System-IO-HVFS.html#t%3AHVFS" >HVFS</A > a => a -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-HVFS-Utils.html#recursiveRemove" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Removes a file or a directory. If a directory, also removes all its child files/directories. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:bracketCWD" ><A NAME="v%3AbracketCWD" ></A ></A ><B >bracketCWD</B > :: <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a</TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#bracketCWD" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >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. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="3" ><A NAME="3" >Temporary Directories </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:mktmpdir" ><A NAME="v%3Amktmpdir" ></A ></A ><B >mktmpdir</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#mktmpdir" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD 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 <TT >"XXXXXX"</TT >. </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:brackettmpdir" ><A NAME="v%3Abrackettmpdir" ></A ></A ><B >brackettmpdir</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a</TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#brackettmpdir" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Creates a temporary directory for your use via <TT ><A HREF="System-Path.html#v%3Amktmpdir" >mktmpdir</A ></TT >, 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. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:brackettmpdirCWD" ><A NAME="v%3AbrackettmpdirCWD" ></A ></A ><B >brackettmpdirCWD</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > a</TD ><TD CLASS="declbut" ><A HREF="src/System-Path.html#brackettmpdirCWD" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >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. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >