Files
hpath/hpath.haddock

152 lines
115 KiB
Plaintext
Raw Normal View History

<0C><><01><><01><><EFBFBD> 
    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00> SafeReturns True<02> if posix-paths was compiled with support for the provided
2016-06-01 14:52:48 +02:00
flag. (As of this writing, the only flag for which this check may be
necessary is $; all other flags will always yield True.) O_CLOEXEC0 is not supported on every POSIX platform. Use
2016-06-01 14:52:48 +02:00
 oCloexec to determine if support for  O_CLOEXEC@ was
compiled into your version of posix-paths. (If not, using oCloexec will
throw an exception.)

 
   
<00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableSafeL#*Open and optionally create this file. See  
2016-06-01 14:52:48 +02:00
$
for information on how to use the FileMode type.Note that passing Just x# as the 4th argument triggers the
1 status flag, which must be set when you pass in 0
to the status flags. Also see the manpage for open(2).<00><00>#status flags of open(2)Just xJ => creates the file with the given modes, Nothing => the file must exist.##<00><00>#<00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableSafe${If the value of the first argument is True, then execute the action
provided in the second argument, otherwise do nothing.%|If the value of the first argument is False, then execute the action
provided in the second argument, otherwise do nothing.$%$%$%$%<00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableSafeL.&Path separator character'*Check if a character is the path separator+\n -> (_chr n == '/') == isPathSeparator n(Search path separator)1Check if a character is the search path separator0\n -> (_chr n == ':') == isSearchPathSeparator n*File extension separator+4Check if a character is the file extension separator)\n -> (_chr n == '.') == isExtSeparator n,#Take a ByteString, split it on the ( .
2016-06-01 14:52:48 +02:00
Blank items are converted to .. Follows the recommendations in
Fhttp://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#splitSearchPath "File1:File2:File3"["File1","File2","File3"]$splitSearchPath "File1::File2:File3"["File1",".","File2","File3"]splitSearchPath ""["."]-Get a list of <00>s in the $PATH variable..Split a <00># into a path+filename and extensionsplitExtension "file.exe"("file",".exe")splitExtension "file" ("file","")"splitExtension "/path/file.tar.gz"("/path/file.tar",".gz"):\path -> uncurry (BS.append) (splitExtension path) == path/Get the final extension from a <00>takeExtension "file.exe"".exe"takeExtension "file"""!takeExtension "/path/file.tar.gz"".gz"0Change a file's extensionJ\path -> let ext = takeExtension path in replaceExtension path ext == path1 Drop the final extension from a <00>dropExtension "file.exe""file"dropExtension "file""file"!dropExtension "/path/file.tar.gz""/path/file.tar"2Add an extension to a <00>addExtension "file" ".exe"
"file.exe"addExtension "file.tar" ".gz" "file.tar.gz"addExtension "/path/" ".ext" "/path/.ext"3 Check if a <00> has an extensionhasExtension "file"FalsehasExtension "file.tar"TruehasExtension "/path.part1/"False4Operator version of 25Split a <00> on the first extension.#splitExtensions "/path/file.tar.gz"("/path/file",".tar.gz")<\path -> uncurry addExtension (splitExtensions path) == path6Remove all extensions from a <00>"dropExtensions "/path/file.tar.gz" "/path/file"7Take all extensions from a <00>"takeExtensions "/path/file.tar.gz" ".tar.gz"82Drop the given extension from a FilePath, and the "." preceding it.
Returns <00>8 if the FilePath does not have the given extension, or
<00>. and the part before the extension if it does.+This function can be more predictable than 63,
2016-06-01 14:52:48 +02:00
especially if the filename might itself contain . characters."stripExtension "hs.o" "foo.x.hs.o" Just "foo.x""stripExtension "hi.o" "foo.x.hs.o"NothingstripExtension ".c.d" "a.b.c.d"
Just "a.b" stripExtension ".c.d" "a.b..c.d" Just "a.b."stripExtension "baz" "foo.bar"NothingstripExtension "bar" "foobar"Nothing,\path -> stripExtension "" path == Just pathS\path -> dropExtension path == fromJust (stripExtension (takeExtension path) path)T\path -> dropExtensions path == fromJust (stripExtension (takeExtensions path) path)9Split a <00> into (path,file). A is the inversesplitFileName "path/file.txt"("path/","file.txt")splitFileName "path/" ("path/","")splitFileName "file.txt"("./","file.txt")Y\path -> uncurry combine (splitFileName path) == path || fst (splitFileName path) == "./":Get the file nametakeFileName "path/file.txt"
"file.txt"takeFileName "path/""";Change the file name9\path -> replaceFileName path (takeFileName path) == path<Drop the file namedropFileName "path/file.txt""path/"dropFileName "file.txt""./"=/Get the file name, without a trailing extensiontakeBaseName "path/file.tar.gz"
"file.tar"takeBaseName """">Change the base name(replaceBaseName "path/file.tar.gz" "bob" "path/bob.gz"9\path -> replaceBaseName path (takeBaseName path) == path?BGet the directory, moving up one level if it's already a directorytakeDirectory "path/file.txt""path"takeDirectory "file""."takeDirectory "/path/to/"
"/path/to"takeDirectory "/path/to""/path"@$Change the directory component of a <00>e\path -> replaceDirectory path (takeDirectory path) `equalFilePath` path || takeDirectory path == "."AJoin two paths togethercombine "/" "file""/file"combine "/path/to" "file""/path/to/file"combine "file" "/absolute/path""/absolute/path"BOperator version of combineC'Split a path into a list of components:splitPath "/path/to/file.txt"["/","path/","to/","file.txt"]+\path -> BS.concat (splitPath path) == pathDJoin a split path back together*\path -> joinPath (splitPath path) == path!joinPath ["path","to","file.txt"]"path/to/file.txt"ELike C, but without trailing slashes$splitDirectories "/path/to/file.txt"["/","path","to","file.txt"]splitDirectories ""[]F!Check if the last character of a <00> is <00>.!hasTrailingPathSeparator "/path/"TruehasTrailingPathSeparator "/"True hasTrailingPathSeparator "/path"FalseGAdd a trailing path separator. addTrailingPathSeparator "/path""/path/"!addTrailingPathSeparator "/path/""/path/"ad
2016-06-01 14:52:48 +02:00
path will never introduce ..+ paths, as the presence of symlinks
means ../b may not reach a/b if it starts from a/c. For a
worked example see
 Vhttp://neilmitchell.blogspot.co.uk/2015/10/filepaths-are-subtle-symlinks-are-hard.htmlthis blog post./makeRelative "/directory" "/directory/file.ext"
"file.ext" makeRelative "/Home" "/home/bob" "/home/bob")makeRelative "/home/" "/home/bob/foo/bar" "bob/foo/bar"makeRelative "/fred" "bob""bob"+makeRelative "/file/test" "/file/test/fred""fred",makeRelative "/file/test" "/file/test/fred/""fred/"*makeRelative "some/path" "some/path/a/b/c""a/b/c"\p -> makeRelative p p == "."E\p -> makeRelative (takeDirectory p) p `equalFilePath` takeFileName p]prop x y -> equalFilePath x y || (isRelative x && makeRelative y x == x) || equalFilePath (y  / makeRelative y x) xKbEquality of two filepaths. The filepaths are normalised
and trailing path separators are dropped.equalFilePath "foo" "foo"TrueequalFilePath "foo" "foo/"TrueequalFilePath "foo" "./foo"TrueequalFilePath "" ""TrueequalFilePath "foo" "/foo"FalseequalFilePath "foo" "FOO"FalseequalFilePath "foo" "../foo"False\p -> equalFilePath p pLCheck if a path is relative+\path -> isRelative path /= isAbsolute pathMCheck if a path is absoluteisAbsolute "/path"TrueisAbsolute "path"False isAbsolute ""FalseN:Is a FilePath valid, i.e. could you create a file like it?
isValid ""False isValid "\0"FalseisValid "/random_ path:*"TrueOKTake a FilePath and make it valid; does not change already valid FilePaths. makeValid """_"makeValid "file\0name" "file_name">\p -> if isValid p then makeValid p == p else makeValid p /= p\p -> isValid (makeValid p)P@Is the given path a valid filename? This includes
"." and "..".isFileName "lal"TrueisFileName "."TrueisFileName ".."True isFileName ""FalseisFileName "\0"FalseisFileName "/random_ path:*"FalseQ7Check if the filepath has any parent directories in it.hasParentDir "/.."TruehasParentDir "foo/bar/.."TruehasParentDir "foo/../bar/."TruehasParentDir "foo/bar"FalsehasParentDir "foo"FalsehasParentDir ""FalsehasParentDir ".."FalseR"Whether the file is a hidden file.hiddenFile ".foo"TruehiddenFile "..foo.bar"TruehiddenFile "some/path/.bar"TruehiddenFile "..."TruehiddenFile "dod.bar"FalsehiddenFile "."FalsehiddenFile ".."False hiddenFile ""False<00>0Combine two paths, assuming rhs is NOT absolute./&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR<00><00>;<00><00><00><00><00><00><00><00><00><00><00><00><00><00>&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR-&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR/&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR<00><00><00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableNone$LSS6Get all files from a directory and its subd
2016-06-01 14:52:48 +02:00
strictly. However the returned list is lazy in that directories will only
be accessed on demand.)Follows symbolic links for the input dir.T?Get all files from a directory and its subdirectories strictly.)Follows symbolic links for the input dir.URecursively apply the action7 to the parent directory and all
files/subdirectories.5This function allows for memory-efficient traversals.)Follows symbolic links for the input dir.Y.Gets all directory contents (not recursively).Z Binding to  fdopendir(3).[Like Y except for a file descriptor.;To avoid complicated error checks, the file descriptor is
always closed, even if Z2 fails. Usually, this
only happens on successful ZD and after the directory
2016-06-01 14:52:48 +02:00
stream is closed. Also see the manpage of  fdopendir(3) for
more details.\*return the canonicalized absolute pathname like canonicalizePath, but uses  realpath(3)<00><00><00><00><00><00><00><00>STU<00>VWXYZ[<00>\
STUVWXYZ[\
Y[STUXWVZ\<00><00><00><00><00><00><00><00>STU<00>VWXYZ[<00>\ Safe0]Path of some base and type.FInternally is a ByteString. The ByteString can be of two formats only: !without trailing path separator: file.txt,  foo/bar.txt,  /foo/bar.txtwith trailing path separator: foo/,  /foo/bar/(There are no duplicate
path separators //, no .., no ./, no ~/, etc.<00>Same as  .The following property holds: x == y "a show x == show y<00>ByteString ordering.The following property holds: 'show x `compare` show y "a x `compare` y<00>ByteString equality.The following property holds: show x == show y "a x == y]<00><00><00><00><00>]<00>]<00><00><00><00><00>+<00> 2015 2016 FP Complete, 2016 Julian Ospald BSD 3 clause"Julian Ospald <hasufell@posteo.de> experimentalportableSafe0b`"Exception when parsing a location.aA filename, without any <00>.b$A relative path; one without a root.cAn absolute path.e@Get a location for an absolute path. Produces a normalised path.Throws: `,parseAbs "/abc" :: Maybe (Path Abs) Just "/abc",parseAbs "/" :: Maybe (Path Abs)Just "/",parseAbs "/abc/def" :: Maybe (Path Abs)Just "/abc/def",parseAbs "/abc/def/.///" :: Maybe (Path Abs)Just "/abc/def/",parseAbs "abc" :: Maybe (Path Abs)Nothing,parseAbs "" :: Maybe (Path Abs)Nothing,parseAbs "/abc/../foo" :: Maybe (Path Abs)Nothingf
2016-06-01 14:52:48 +02:00
path.
Note that filepath may contain any number of ./ but may not consist
solely of ./$. It also may not contain a single ..
anywhere.Throws: ` )parseRel "abc" :: Maybe (Path Rel)
Just "abc")parseRel "def/" :: Maybe (Path Rel) Just "def/")parseRel "abc/def" :: Maybe (Path Rel)Just "abc/def")parseRel "abc/def/." :: Maybe (Path Rel)Just "abc/def/")parseRel "/abc" :: Maybe (Path Rel)Nothing)parseRel "" :: Maybe (Path Rel)Nothing)parseRel "abc/../foo" :: Maybe (Path Rel)Nothing)parseRel "." :: Maybe (Path Rel)Nothing)parseRel ".." :: Maybe (Path Rel)NothinggAParses a filename. Filenames must not contain slashes.
Excludes <00> and '..'.Throws: `
2016-06-01 14:52:48 +02:00
'parseFn "abc" :: Maybe (Path Fn)
Just "abc"'parseFn "..." :: Maybe (Path Fn)
Just "..."'parseFn "def/" :: Maybe (Path Fn)Nothing'parseFn "abc/def" :: Maybe (Path Fn)Nothing'parseFn "abc/def/." :: Maybe (Path Fn)Nothing'parseFn "/abc" :: Maybe (Path Fn)Nothing'parseFn "" :: Maybe (Path Fn)Nothing'parseFn "abc/../foo" :: Maybe (Path Fn)Nothing'parseFn "." :: Maybe (Path Fn)Nothing'parseFn ".." :: Maybe (Path Fn)Nothingh&Convert any Path to a ByteString type.i.Convert an absolute Path to a ByteString type.j-Convert a relative Path to a ByteString type.kAppend two paths.bThe second argument must always be a relative path, which ensures
2016-06-01 14:52:48 +02:00
that undefinable things like `"abc" <> "/def"` cannot happen.<02>Technically, the first argument can be a path that points to a non-directory,
because this library is IO-agnostic and makes no assumptions about
file types.7(MkPath "/") </> (MkPath "file" :: Path Rel)"/file"7(MkPath "/path/to") </> (MkPath "file" :: Path Rel)"/path/to/file"7(MkPath "/") </> (MkPath "file/lal" :: Path Rel) "/file/lal"7(MkPath "/") </> (MkPath "file/" :: Path Rel)"/file/"lIStrip directory from path, making it relative to that directory.
2016-06-01 14:52:48 +02:00
Throws Couldn'tStripPrefixDir* if directory is not a parent of the path.The bases must match.N(MkPath "/lal/lad") `stripDir` (MkPath "/lal/lad/fad") :: Maybe (Path Rel)
Just "fad"N(MkPath "lal/lad") `stripDir` (MkPath "lal/lad/fad") :: Maybe (Path Rel)
Just "fad"N(MkPath "/") `stripDir` (MkPath "/") :: Maybe (Path Rel)NothingN(MkPath "/lal/lad/fad") `stripDir` (MkPath "/lal/lad") :: Maybe (Path Rel)NothingN(MkPath "fad") `stripDir` (MkPath "fad") :: Maybe (Path Rel)Nothingm>Is p a parent of the given location? Implemented in terms of
l. The bases must match.<(MkPath "/lal/lad") `isParentOf` (MkPath "/lal/lad/fad")True;(MkPath "lal/lad") `isParentOf` (MkPath "lal/lad/fad")True1(MkPath "/") `isParentOf` (MkPath "/")False8(MkPath "/lal/lad/fad") `isParentOf` (MkPath "/lal/lad")False3(MkPath "fad") `isParentOf` (MkPath "fad")FalsenGet all parents of a path.%getAllParents (MkPath "/abs/def/dod")["/abs/def","/abs","/"]getAllParents (MkPath "/")[]o%Extract the directory name of a path.The following properties hold: dirname (p </> a) == dirname pdirname (MkPath "/abc/def/dod")
"/abc/def"dirname (MkPath "/")"/"p Extract the file part of a path.The following properties hold:  basename (p </> a) == basename aThrows: _ if given the root path "/"3basename (MkPath "/abc/def/dod") :: Maybe (Path Fn)
Just "dod"3basename (MkPath "/") :: Maybe (Path Fn)Nothing^_<00>`<00><00><00><00>abcdefghijklmnopqrstuvw]^_`abcdefghijklmnopqrsc]ba`_^degfijhkpomnlqrs^_<00>`<00><00><00><00>abcdefghijklmnopqrstuvw<00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableSafe0T <00>Uses <00> and throws ~ if it returns True.<00>^Check if the files are the same by examining device and file id.
This follows symbolic links.<00><02>Checks whether the destination directory is contained
2016-06-01 14:52:48 +02:00
within the source directory by comparing the device+file ID of the
source directory with all device+file IDs of the parent directories
of the destination.<00>RChecks if the given file exists and is not a directory.
Does not follow symlinks.<00>NChecks if the given file exists and is a directory.
Does not follow symlinks.<00>,Checks whether a file or folder is writable.<00>WChecks whether the directory at the given path exists and can be
opened. This invokes  openDirStream which follows symlinks.<00> Throws a <00>G HPathIOException if the directory at the given
path cannot be opened.<00><02>Carries out an action, then checks if there is an IOException and
2016-06-01 14:52:48 +02:00
a specific errno. If so, then it carries out another action, otherwise
it rethrows the error.<00><02>Execute the given action and retrow IO exceptions as a new Exception
2016-06-01 14:52:48 +02:00
that have the given errno. If errno does not match the exception is rethrown
as is.<00>Like <00>, with arguments swapped.<00>Like <00><02>, but allows to have different clean-up
2016-06-01 14:52:48 +02:00
actions depending on whether the in-between computation
has raised an exception or not. &{|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>
source dirfull destination,  dirname dest
must exist<00><00><00><00><00><00>errno to catch-action to try, which can raise an IOExceptionEaction to carry out in case of an IOException and
if errno matches<00>errno to catchrethrow as if errno matches action to try<00><00>computation to run first8computation to run last, when
no exception was raised8computation to run last,
when an exception was raisedcomputation to run in-between<00>reaction on IO errorsreaction on HPathIOException<00><00>${|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>${|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>{ |}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableNoneSzApplies realpath on the given absolute path.Throws:<00>- if the file at the given path does not exist<00> if the symlink is broken<00>YCopies a directory recursively to the given destination.
Does not follow symbolic links.6For directory contents, this has the same behavior as <00>1
and thus will ignore any file type that is not <00>,
<00> or <00>.Safety/reliability concerns:
not atomicexamines filetypes explicitlyan explicit check <00><02> is carried out for the
2016-06-01 14:52:48 +02:00
top directory for basic sanity, because otherwise we might end up
with an infinite copy loop... however, this operation is not
carried out recursively (because it's slow)Throws:<00># if source directory does not exist<00>$ if output directory is not writable<00>$ if source directory can't be opened<00>, if source directory is wrong type (symlink)<00>1 if source directory is wrong type (regular file)<00> if destination already exists~. if source and destination are the same file ({)( if destination is contained in source ({)<00>Like <00>6 except it overwrites contents of directories
if any.6For directory contents, this has the same behavior as <00>1
and thus will ignore any file type that is not <00>,
<00> or <00>.Throws:<00># if source directory does not exist<00>$ if output directory is not writable<00>$ if source directory can't be opened<00>, if source directory is wrong type (symlink)<00>1 if source directory is wrong type (regular file)~. if source and destination are the same file ({)( if destination is contained in source ({)<00>Recreate a symlink.Throws:<00>- if source file is wrong type (not a symlink)<00>) if output directory cannot be written to<00>% if source directory cannot be opened<00># if destination file already exists~. if source and destination are the same file ({) Note: calls symlink<00><02>Copies the given regular file to the given destination.
2016-06-01 14:52:48 +02:00
Neither follows symbolic links, nor accepts them.
For "copying" symbolic links, use <00> instead.yNote that this is still sort of a low-level function and doesn't
examine file types. For a more high-level version, use <00>
2016-06-01 14:52:48 +02:00
instead.Safety/reliability concerns: when used on <00>], reads the "contents" and copies
them to a regular file, which might take indefinitely when used on <00><02>, may either read the "contents"
2016-06-01 14:52:48 +02:00
and copy them to a regular file (potentially hanging indefinitely)
or may create a regular empty destination file when used on <00>, will hang indefinitelyThrows:<00> if source file does not exist<00> if source file is a a <00><00>$ if output directory is not writable<00>$ if source directory can't be opened<00>4 if source file is wrong type (symlink or directory)<00> if destination already exists~. if source and destination are the same file ({) Note: calls sendfile and possibly <00>/write as fallback<00>Like <00>< except it overwrites the destination if it already
exists.Safety/reliability concerns: when used on <00>], reads the "contents" and copies
them to a regular file, which might take indefinitely when used on <00><02>, may either read the "contents"
2016-06-01 14:52:48 +02:00
and copy them to a regular file (potentially hanging indefinitely)
or may create a regular empty destination file when used on <00>, will hang indefinitely$not atomic, since it uses read/writeThrows:<00> if source file does not exist<00> if source file is a <00><00>$ if output directory is not writable<00>$ if source directory can't be opened<00>4 if source file is wrong type (symlink or directory)~. if source and destination are the same file ({) Note: calls sendfile and possibly <00>/write as fallback<00><02>Copies a regular file, directory or symbolic link. In case of a
2016-06-01 14:52:48 +02:00
symbolic link it is just recreated, even if it points to a directory.
Any other file type is ignored.Safety/reliability concerns:examines filetypes explicitlycalls <00> for directories<00>Like <00><02> except it overwrites the destination if it already exists.
2016-06-01 14:52:48 +02:00
For directories, this overwrites contents without pruning them, so the resulting
directory may have more files than have been copied.Safety/reliability concerns:examines filetypes explicitlycalls <00> for directories<00>Deletes the given file. Raises eISDIR8
if run on a directory. Does not follow symbolic links.Throws:<00> for wrong file type (directory)<00> if the file does not exist<00> if the directory cannot be read<00>ADeletes the given directory, which must be empty, never symlinks.Throws:<00>+ for wrong file type (symlink to directory)<00># for wrong file type (regular file)<00> if directory does not exist<00> if directory is not empty<00>. if we can't open or write to parent directory Notes: calls rmdir<00>PDeletes the given directory recursively. Does not follow symbolic
links. Tries <00>/ first before attemtping a recursive
deletion.(On directory contents this behaves like <00>1
and thus will ignore any file type that is not <00>,
<00> or <00>.Safety/reliability concerns:
not atomicexamines filetypes explicitlyThrows:<00>+ for wrong file type (symlink to directory)<00># for wrong file type (regular file)<00> if directory does not exist<00>. if we can't open or write to parent directory<00><02>Deletes a file, directory or symlink.
2016-06-01 14:52:48 +02:00
In case of directory, performs recursive deletion. In case of
a symlink, the symlink file is deleted.
Any other file type is ignored.Safety/reliability concerns:examines filetypes explicitlycalls <00> for directories<00>eOpens a file appropriately by invoking xdg-open. The file type
is not checked. This forks a process.<00>BExecutes a program with the given arguments. This forks a process.<00>LCreate an empty regular file at the given directory with the given filename.Throws:<00>) if output directory cannot be written to<00># if destination file already exists<00>ICreate an empty directory at the given directory with the given filename.Throws:<00>) if output directory cannot be written to<00>( if destination directory already exists<00>Create a symlink.Throws:<00>) if output directory cannot be written to<00># if destination file already exists Note: calls symlink<00>nRename a given file with the provided filename. Destination and source
must be on the same device, otherwise <00> will be raised.CDoes not follow symbolic links, but renames the symbolic link file.Safety/reliability concerns:@has a separate set of exception handling, apart from the syscallThrows:<00> if source file does not exist<00>) if output directory cannot be written to<00>% if source directory cannot be opened<00>3 if source and destination are on different devices<00>% if destination file already exists ({)<00>* if destination directory already exists ({)~. if destination and source are the same file ({) Note: calls <00>3 (but does not allow to rename over existing files)<00>dMove a file. This also works across devices by copy-delete fallback.
And also works on directories.CDoes not follow symbolic links, but renames the symbolic link file.Safety/reliability concerns:-copy-delete fallback is inherently non-atomicsince this function calls <00> and <00> as a fallback
to <00>, file types that are not <00>, <00>
2016-06-01 14:52:48 +02:00
or <00> may be ignoredThrows:<00> if source file does not exist<00>) if output directory cannot be written to<00>% if source directory cannot be opened<00>% if destination file already exists ({)<00>* if destination directory already exists ({)~. if destination and source are the same file ({) Note: calls <00>3 (but does not allow to rename over existing files)<00>Like <00>., but overwrites the destination if it exists.CDoes not follow symbolic links, but renames the symbolic link file."Ignores any file type that is not <00>, <00> or
<00>.Safety/reliability concerns:-copy-delete fallback is inherently non-atomic?checks for file types and destination file existence explicitlyThrows:<00> if source file does not exist<00>) if output directory cannot be written to<00>% if source directory cannot be opened~. if destination and source are the same file ({) Note: calls <00>3 (but does not allow to rename over existing files)<00>#Default permissions for a new file.<00>(Default permissions for a new directory.<00>tGets all filenames of the given directory. This excludes "." and "..".
This version does not follow symbolic links.Throws:<00> if directory does not exist<00> if file type is wrong (file)<00>( if file type is wrong (symlink to file)<00>' if file type is wrong (symlink to dir)<00> if directory cannot be opened<00>YGet the file type of the file located at the given path. Does
not follow symbolic links.Throws:<00> if the file does not exist<00>* if any part of the path is not accessible!z<00><00><00><00><00><00><00><00><00>
source dirfull destination<00>
source dirfull destination<00>the old symlink filedestination file<00> source filedestination file<00> source filedestination file<00> source filedestination file<00><00><00><00><00><00><00><00>program arguments<00><00><00>destination filepath the symlink points to<00><00> file to move destination<00> file to move destination<00><00><00> dir to read<00> z<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00> <00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>zz<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg hijklmnhopq rsMtuvwxyz{|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>
<00>   "hpath-0.7.3-9NgSqBQGcsP6NtBoiOiwzeSystem.Posix.Directory.ForeignSystem.Posix.FDHPath.IO.UtilsSystem.Posix.FilePath!System.Posix.Directory.TraversalsHPathHPath.IOHPath.IO.Errors System.PosixFilesHPath.Internal
2016-06-01 14:52:48 +02:00
toFilePathFlagsUnsupportedFlagDirTypeunFlags isSupportedoCloexecdtBlkdtChrdtDirdtFifodtLnkdtRegdtSock dtUnknownoAppendoAsyncoCreat
oDirectoryoExcloNoctty oNofollow oNonblockoRdonlyoWronlyoRdwroSyncoTruncpathMax
unionFlags $fEqDirType $fShowDirType $fEqFlags $fShowFlagsopenFdwhenMunlessM pathSeparatorisPathSeparatorsearchPathSeparatorisSearchPathSeparator extSeparatorisExtSeparatorsplitSearchPath getSearchPathsplitExtension takeExtensionreplaceExtension dropExtension addExtension hasExtension<.>splitExtensionsdropExtensionstakeExtensionsstripExtension splitFileName takeFileNamereplaceFileName dropFileName takeBaseNamereplaceBaseName takeDirectoryreplaceDirectorycombine</> splitPathjoinPathsplitDirectorieshasTrailingPathSeparatoraddTrailingPathSeparatordropTrailingPathSeparator normalise makeRelative equalFilePath
2016-06-01 14:52:48 +02:00
isRelative
isAbsoluteisValid makeValid
isFileName hasParentDir
hiddenFileallDirectoryContentsallDirectoryContents'traverseDirectoryunpackDirStream packDirStream
readDirEntgetDirectoryContents fdOpendirgetDirectoryContents'realpathPathRelC PathExceptionPathParseExceptionFnRelAbsparseAbsparseRelparseFnfromAbsfromRelstripDir
isParentOf getAllParentsdirnamebasename withAbsPath withRelPath
withFnPath$fRelCFn $fRelCRel$fExceptionPathException$fExceptionPathParseException$fShowPathParseException$fShowPathExceptioncanonicalizePathHPathIOExceptionFileDoesNotExistDirDoesNotExistSameFileDestinationInSource FileDoesExist DirDoesExistInvalidOperationCan'tOpenDirectory
CopyFailedisFileDoesNotExistisDirDoesNotExist
2016-06-01 14:52:48 +02:00
isSameFileisDestinationInSourceisFileDoesExistisDirDoesExistisInvalidOperationisCan'tOpenDirectory isCopyFailedthrowFileDoesExistthrowDirDoesExistthrowFileDoesNotExistthrowDirDoesNotExist throwSameFilesameFilethrowDestinationInSource doesFileExistdoesDirectoryExist
isWritablecanOpenDirectorythrowCantOpenDirectory
catchErrnorethrowErrnoAs handleIOError
bracketeer reactOnError$fExceptionHPathIOException$fShowHPathIOException$fEqHPathIOException$fDataHPathIOExceptionFileType Directory RegularFile SymbolicLink BlockDeviceCharacterDevice NamedPipeSocketcopyDirRecursivecopyDirRecursiveOverwriterecreateSymlinkcopyFilecopyFileOverwriteeasyCopyeasyCopyOverwrite
2016-06-01 14:52:48 +02:00
deleteFile deleteDirdeleteDirRecursive
easyDeleteopenFile executeFilecreateRegularFile createDir createSymlink
renameFilemoveFilemoveFileOverwrite newFilePerms newDirPerms getDirsFiles getFileType $fEqFileType$fShowFileTypec_openopen_ unix-2.7.2.0 System.Posix.ByteString.FilePath RawFilePathbaseGHC.BaseNothingJustGHC.Real/
combineRawsplitFileNameRawthrowErrnoPathIfMinus1_throwErrnoPathIfMinus1throwErrnoPathIfNullthrowErrnoPathIf_throwErrnoPathIfthrowErrnoPaththrowErrnoPathIfRetrythrowErrnoPathIfNullRetrythrowErrnoPathIfMinus1Retry_throwErrnoPathIfMinus1RetrypeekFilePathLen peekFilePath withFilePathCDirentCDir c_fdopendir
2016-06-01 14:52:48 +02:00
c_realpathc_typec_name c_freeDirEnt c_readdiractOnDirContents_dirloop
$fShowPath $fOrdPath$fEqPathMkPath $fNFDataPath.RootDirHasNoBasename
InvalidAbs
InvalidRel InvalidFnCouldn'tStripPrefixTPSSystem.IO.Error catchIOErrorControl.Exception.BasebracketGHC.IO.Exception NoSuchThingPermissionDeniedInvalidArgument AlreadyExists Text.ReadreadInappropriateTypeUnsatisfiedConstraintsForeign.C.ErroreXDEVUnsupportedOperationSystem.Posix.Files.ByteStringrename _copyFile