Files
hpath/hpath.haddock

170 lines
112 KiB
Plaintext
Raw Normal View History

<0C><><01>h<01>ո 
    !"#$%&'()*+,-./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> 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.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
 oCloexec to determine if support for  O_CLOEXEC@ was
2016-06-01 14:52:48 +02:00
compiled into your version of posix-paths. (If not, using oCloexec will
throw an exception.)
 
 
   
 <00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableSafeF!*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> experimentalportableSafeF."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",Change a file's extensionJ\path -> let ext = takeExtension path in replaceExtension path ext == path- Drop the final extension from a <00>dropExtension "file.exe""file"dropExtension "file""file"!dropExtension "/path/file.tar.gz""/path/file.tar".Add an extension to a <00>addExtension "file" ".exe"
"file.exe"addExtension "file.tar" ".gz" "file.tar.gz"addExtension "/path/" ".ext" "/path/.ext"/ Check if a <00> has an extensionhasExtension "file"FalsehasExtension "file.tar"TruehasExtension "/path.part1/"False0Operator version of .1Split a <00> on the first extension.#splitExtensions "/path/file.tar.gz"("/path/file",".tar.gz")<\path -> uncurry addExtension (splitExtensions path) == path2Remove all extensions from a <00>"dropExtensions "/path/file.tar.gz" "/path/file"3Take all extensions from a <00>"takeExtensions "/path/file.tar.gz" ".tar.gz"42Drop 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 23,
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)5Split a <00> into (path,file). = 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) == "./"6Get the file nametakeFileName "path/file.txt"
"file.txt"takeFileName "path/"""7Change the file name9\path -> replaceFileName path (takeFileName path) == path8Drop the file namedropFileName "path/file.txt""path/"dropFileName "file.txt""./"9/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 == "."=Join two paths togethercombine "/" "file""/file"combine "/path/to" "file""/path/to/file"combine "file" "/absolute/path""/absolute/path">Operator version of combine?'Split a path into a list of components:splitPath "/path/to/file.txt"["/","path/","to/","file.txt"]+\path -> BS.concat (splitPath path) == path@Join a split path back together*\path -> joinPath (splitPath path) == path!joinPath ["path","to","file.txt"]"path/to/file.txt"ALike ?, but without trailing slashes$splitDirectories "/path/to/file.txt"["/","path","to","file.txt"]splitDirectories ""[]B!Check if the last character of a <00> is <00>.!hasTrailingPathSeparator "/path/"TruehasTrailingPathSeparator "/"True hasTrailingPathSeparator "/path"FalseCAdd 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) xGbEquality 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 pHCheck if a path is relative+\path -> isRelative path /= isAbsolute pathICheck if a path is absoluteisAbsolute "/path"TrueisAbsolute "path"False isAbsolute ""FalseJ:Is a FilePath valid, i.e. could you create a file like it?
isValid ""False isValid "\0"FalseisValid "/random_ path:*"TrueKKTake 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)L@Is the given path a valid filename? This includes
"." and "..".isFileName "lal"TrueisFileName "."TrueisFileName ".."True isFileName ""FalseisFileName "\0"FalseisFileName "/random_ path:*"FalseM7Check if the filepath has any parent directories in it.hasParentDir "/.."TruehasParentDir "foo/bar/.."TruehasParentDir "foo/../bar/."TruehasParentDir "foo/bar"FalsehasParentDir "foo"FalsehasParentDir ""FalsehasParentDir ".."FalseN"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:;<=>?@ABCDEFGHIJKLMN<00><00>;<00><00><00><00><00><00><00><00><00><00><00><00><00><00>"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN-"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN/"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN<00><00><00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableNone FMO6Get 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.P?Get all files from a directory and its subdirectories strictly.)Follows symbolic links for the input dir.QRecursively 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.U.Gets all directory contents (not recursively).V Binding to  fdopendir(3).WLike U except for a file descriptor.;To avoid complicated error checks, the file descriptor is
always closed, even if V2 fails. Usually, this
only happens on successful VD 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.X*return the canonicalized absolute pathname like canonicalizePath, but uses  realpath(3)<00><00><00><00><00><00><00><00>OPQ<00>RSTUVW<00>X
OPQRSTUVWX
UWOPQTSRVX<00><00><00><00><00><00><00><00>OPQ<00>RSTUVW<00>X Safe+YPath 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 == yY<00><00><00><00><00>Y<00>Y<00><00><00><00><00>+<00> 2015 2016 FP Complete, 2016 Julian Ospald BSD 3 clause"Julian Ospald <hasufell@posteo.de> experimentalportableSafe+Z\"Exception when parsing a location.]A filename, without any <00>.^$A relative path; one without a root._An absolute path.a@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)Nothingb
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)NothingcAParses 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)Nothingd&Convert any Path to a ByteString type.e.Convert an absolute Path to a ByteString type.f-Convert a relative Path to a ByteString type.gAppend 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/"hIStrip 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)Nothingi>Is p a parent of the given location? Implemented in terms of
h. 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")FalsejGet all parents of a path.%getAllParents (MkPath "/abs/def/dod")["/abs/def","/abs","/"]getAllParents (MkPath "/")[]k%Extract the directory name of a path.The following properties hold: dirname (p </> a) == dirname pdirname (MkPath "/abc/def/dod")
"/abc/def"dirname (MkPath "/")"/"l 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 Z[<00>\<00><00><00><00>]^_`abcdefghijklmno<00><00><00><00><00>YZ[\]^_`abcdefghijklmno_Y^]\[Z`acbefdglkijhmnoZ[<00>\<00><00><00><00>]^_`abcdefghijklmno<00><00><00><00><00><00> 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableSafeN <00>Uses ~ and throws t 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 yG 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. )qrstuvwxyz{<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>&qrstuvwxyz{|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>&qrstuvwxyz{|}~<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>q
rstuvwxyz{<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> experimentalportableNoneMpApplies 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>sThe mode for copy and file moves.
Overwrite mode is usually not very well defined, but is a convenience
shortcut.<00>fail if any target exists<00>overwrite targets<00>%The mode for any recursive operation.On <00><02> the whole operation fails immediately if any of the
recursive sub-operations fail, which is sort of the default
for IO operations.On <00>` skips errors in the recursion and keeps on recursing.
However all errors are collected in the {= error type,
which is raised finally if there was any error.<00>YCopies a directory recursively to the given destination.
Does not follow symbolic links.DFor directory contents, this will ignore any file type that is not
<00>, <00> or <00>.For <00><02> mode this does not prune destination directory contents,
so the destination might contain more files than the source after
the operation has completed.NNote that there is no guaranteed ordering of the exceptions
contained within { in <00> RecursiveMode.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 source directory can't be openedt4 if source and destination are the same file
(q)u. if destination is contained in source
(q)
Throws in <00> RecursiveMode only:<00>$ if output directory is not writable<00>, if source directory is wrong type (symlink)<00>1 if source directory is wrong type (regular file)
Throws in <00> RecursiveMode only:{f if any of the recursive operations that are not
part of the top-directory sanity-checks fails (q)
Throws in <00> CopyMode only:<00> if destination already exists<00>Recreate a symlink.In <00>3 mode only files and empty directories are deleted.Safety/reliability concerns:<00> mode is inherently non-atomicThrows:<00>- if source file is wrong type (not a symlink)<00>) if output directory cannot be written to<00>% if source directory cannot be openedt4 if source and destination are the same file
(q)
Throws in <00> mode only:<00># if destination file already exists
Throws in <00> mode only:<00>+ if destination file is non-empty directory 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.In <00>4 mode only overwrites actual files, not directories.Safety/reliability concerns:<00> mode is not atomic 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)t4 if source and destination are the same file
(q)
Throws in <00> mode only:<00> if destination already exists 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>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>MCreate 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>: if source and destination are on different
devicesv, if destination file already exists
(q)w1 if destination directory already exists
(q)t5 if destination and source are the same file
(q) 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:<00> mode is not atomic-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 ignoredfor <00>L mode, the destination will be deleted (not recursively)
before movingThrows:<00> if source file does not exist<00>) if output directory cannot be written to<00>% if source directory cannot be openedt5 if destination and source are the same file
(q)
Throws in <00> mode only:v% if destination file already exists (q)w0 if destination directory already exists
(q) 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.FThe contents are not sorted and there is no guarantee on the ordering.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#p<00><00><00><00><00><00><00><00><00><00><00><00><00><00><00>
source dirfull destination<00>the old symlink filedestination file<00> source filedestination file<00> source filedestination file<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><00><00> dir to read<00>"p<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>pp<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>  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc defghijdklm noIpqrstuvwxyz{|}~<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>
CCIKGv0REfKHD8TEvtpIqiHPath.IO.UtilsSystem.Posix.Directory.ForeignSystem.Posix.FDSystem.Posix.FilePath!System.Posix.Directory.TraversalsHPathHPath.IOHPath.IO.Errors System.PosixFilesHPath.Internal
toFilePathwhenMunlessMFlagsUnsupportedFlagDirTypeunFlags isSupportedoCloexecdtBlkdtChrdtDirdtFifodtLnkdtRegdtSock dtUnknownoAppendoAsyncoCreat
2016-06-01 14:52:48 +02:00
oDirectoryoExcloNoctty oNofollow oNonblockoRdonlyoWronlyoRdwroSyncoTruncpathMax
unionFlagsopenFd 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
withFnPathcanonicalizePathHPathIOExceptionFileDoesNotExistDirDoesNotExistSameFileDestinationInSource FileDoesExist DirDoesExistInvalidOperationCan'tOpenDirectory
CopyFailedRecursiveFailureisFileDoesNotExistisDirDoesNotExist
isSameFileisDestinationInSourceisFileDoesExistisDirDoesExistisInvalidOperationisCan'tOpenDirectory isCopyFailedisRecursiveFailurethrowFileDoesExistthrowDirDoesExistthrowFileDoesNotExistthrowDirDoesNotExist throwSameFilesameFilethrowDestinationInSource doesFileExistdoesDirectoryExist
2016-06-01 14:52:48 +02:00
isWritablecanOpenDirectorythrowCantOpenDirectory
catchErrnorethrowErrnoAs handleIOError
bracketeer reactOnErrorCopyModeStrict Overwrite RecursiveMode FailEarlyCollectFailuresFileType Directory RegularFile SymbolicLink BlockDeviceCharacterDevice NamedPipeSocketcopyDirRecursiverecreateSymlinkcopyFileeasyCopy
2016-06-01 14:52:48 +02:00
deleteFile deleteDirdeleteDirRecursive
easyDeleteopenFile executeFilecreateRegularFile createDir createSymlink
renameFilemoveFile newFilePerms newDirPerms getDirsFiles getFileTypec_openopen_unix_A3WgcI5QiHK4PDo4jSYdwQ 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'tStripPrefixTPS stripPrefix$fRelCFn $fRelCRel$fExceptionPathException$fExceptionPathParseExceptionSystem.IO.Error catchIOErrorControl.Exception.BasebrackettoConstr$fExceptionHPathIOException$fShowHPathIOExceptionGHC.IO.Exception NoSuchThingPermissionDeniedInvalidArgumentInappropriateType AlreadyExistsUnsatisfiedConstraints Text.ReadreadForeign.C.ErroreXDEVUnsupportedOperationSystem.Posix.Files.ByteStringrename _copyFile