!W      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableNone2WX( hpath-directoryA type for giving failure hints on recursive failure, which allows to programmatically make choices without examining the weakly typed I/O error attributes (like ioeGetFileName).`The first argument to the data constructor is always the source and the second the destination. hpath-directoryJAdditional generic IO exceptions that the posix functions do not provide.hpath-directoryThrows  AlreadyExists W if file exists.hpath-directoryThrows  AlreadyExists W if directory exists.hpath-directoryUses  and throws   if it returns True.hpath-directory^Check if the files are the same by examining device and file id. This follows symbolic links.hpath-directoryChecks whether the destination directory is contained 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.hpath-directoryCarries out an action, then checks if there is an IOException and a specific errno. If so, then it carries out another action, otherwise it rethrows the error.hpath-directoryExecute the given action and retrow IO exceptions as a new Exception that have the given errno. If errno does not match the exception is rethrown as is.hpath-directoryLike X, with arguments swapped.hpath-directoryLike Y, but allows to have different clean-up actions depending on whether the in-between computation has raised an exception or not.hpath-directory source dirhpath-directoryfull destination,  dirname dest must existhpath-directoryerrno to catchhpath-directory-action to try, which can raise an IOExceptionhpath-directoryEaction to carry out in case of an IOException and if errno matcheshpath-directoryerrno to catchhpath-directoryrethrow as if errno matcheshpath-directory action to tryhpath-directorycomputation to run firsthpath-directory8computation to run last, when no exception was raisedhpath-directory8computation to run last, when an exception was raisedhpath-directorycomputation to run in-between hpath-directoryreaction on IO errorshpath-directoryreaction on HPathIOException      2020 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableNoneWn(hpath-directoryWChecks whether the directory at the given path exists and can be opened. This invokes Z which follows symlinks.hpath-directory,Checks whether a file or folder is writable.BOnly eACCES, eROFS, eTXTBSY, ePERM are catched (and return False).Throws:[ if the file does not existhpath-directoryNChecks if the given file exists and is a directory. Does not follow symlinks.+Only eNOENT is catched (and returns False).hpath-directoryRChecks if the given file exists and is not a directory. Does not follow symlinks.+Only eNOENT is catched (and returns False).hpath-directoryJConverts any path to an absolute path. This is done in the following way:6if the path is already an absolute one, just return it<if it's a relative path, prepend the current directory to ithpath-directoryApplies realpath on the given path.Throws:[- if the file at the given path does not exist[ if the symlink is broken&hpath-directorysThe mode for copy and file moves. Overwrite mode is usually not very well defined, but is a convenience shortcut.'hpath-directoryfail if any target exists(hpath-directoryoverwrite targets)hpath-directory(The error mode for recursive operations.On * the whole operation fails immediately if any of the recursive sub-operations fail, which is sort of the default for IO operations.On +` skips errors in the recursion and keeps on recursing. However all errors are collected in the N error type, which is raised finally if there was any error. Also note that K does not give any guarantees on the ordering of the collected exceptions.4hpath-directoryCopies the contents of a directory recursively to the given destination, while preserving permissions. Does not follow symbolic links. This behaves more or less like the following, without descending into the destination if it already exists: ) cp -a /source/dir /destination/somedir DFor directory contents, this will ignore any file type that is not ., / or -.For ( copy mode this does not prune destination directory contents, so the destination might contain more files than the source after the operation has completed. Permissions of existing directories are fixed.Safety/reliability concerns: not atomicexamines filetypes explicitlyan explicit check  is carried out for the 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:[# if source directory does not exist\$ if source directory can't be opened 4 if source and destination are the same file ( ) . if destination is contained in source ( ) Throws in * RecursiveErrorMode only:\$ if output directory is not writable], if source directory is wrong type (symlink)^1 if source directory is wrong type (regular file) Throws in + RecursiveErrorMode only:e if any of the recursive operations that are not part of the top-directory sanity-checks fail ( ) Throws in ' CopyMode only:_ if destination already existsNote: may call getcwd) (only if destination is a relative path)5hpath-directoryRecreate a symlink.In (8 copy mode only files and empty directories are deleted.Safety/reliability concerns:( mode is inherently non-atomicThrows:]- if source file is wrong type (not a symlink)\) if output directory cannot be written to\% if source directory cannot be opened 4 if source and destination are the same file ( ) Throws in ' mode only:_ if destination already exists Throws in ( mode only:`+ if destination file is non-empty directoryNotes:calls symlinkcalls getcwd6 in Overwrite mode (if destination is a relative path)6hpath-directoryCopies the given regular file to the given destination. Neither follows symbolic links, nor accepts them. For "copying" symbolic links, use 5 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 7 instead.In (> copy mode only overwrites actual files, not directories. In '* mode the destination file must not exist.Safety/reliability concerns:( mode is not atomic when used on 1], reads the "contents" and copies them to a regular file, which might take indefinitely when used on 0, may either read the "contents" and copy them to a regular file (potentially hanging indefinitely) or may create a regular empty destination file when used on 2, will hang indefinitelyThrows:[ if source file does not exist[ if source file is a a 3\$ if output directory is not writable\$ if source directory can't be opened]4 if source file is wrong type (symlink or directory) 4 if source and destination are the same file ( ) Throws in ' mode only:_ if destination already existsNotes: may call getcwd6 in Overwrite mode (if destination is a relative path)7hpath-directoryCopies a regular file, directory or symbolic link. In case of a 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 4 for directoriesNote: may call getcwd6 in Overwrite mode (if destination is a relative path)8hpath-directoryDeletes the given file. Raises eISDIR8 if run on a directory. Does not follow symbolic links.Throws:^ for wrong file type (directory)[ if the file does not exist\ if the directory cannot be read Notes: calls unlink9hpath-directoryADeletes the given directory, which must be empty, never symlinks.Throws:^+ for wrong file type (symlink to directory)^# for wrong file type (regular file)[ if directory does not exist` if directory is not empty\. if we can't open or write to parent directory Notes: calls rmdir:hpath-directoryPDeletes the given directory recursively. Does not follow symbolic links. Tries 9/ first before attemtping a recursive deletion.(On directory contents this behaves like ;1 and thus will ignore any file type that is not ., / or -.Safety/reliability concerns: not atomicexamines filetypes explicitlyThrows:^+ for wrong file type (symlink to directory)^# for wrong file type (regular file)[ if directory does not exist\. if we can't open or write to parent directory;hpath-directoryDeletes a file, directory or symlink. 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 : for directories<hpath-directoryeOpens a file appropriately by invoking xdg-open. The file type is not checked. This forks a process.=hpath-directoryBExecutes a program with the given arguments. This forks a process.>hpath-directoryMCreate an empty regular file at the given directory with the given filename.Throws:\) if output directory cannot be written to_ if destination already exists[? if any of the parent components of the path do not exist?hpath-directoryICreate an empty directory at the given directory with the given filename.Throws:\) if output directory cannot be written to_ if destination already exists[? if any of the parent components of the path do not exist@hpath-directoryICreate an empty directory at the given directory with the given filename.Throws:\) if output directory cannot be written to[? if any of the parent components of the path do not existAhpath-directoryCreate an empty directory at the given directory with the given filename. All parent directories are created with the same filemode. This basically behaves like:  mkdir -p /some/dir Safety/reliability concerns: not atomicThrows:\O if any part of the path components do not exist and cannot be written to_= if destination already exists and is *not* a directory Note: calls getcwd% if the input path is a relative pathBhpath-directoryCreate a symlink.Throws:\) if output directory cannot be written to_# if destination file already exists[? if any of the parent components of the path do not exist Note: calls symlinkChpath-directorynRename a given file with the provided filename. Destination and source must be on the same device, otherwise a 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:[ if source file does not exist\) if output directory cannot be written to\% if source directory cannot be openedb: if source and destination are on different devices_ if destination already exists 5 if destination and source are the same file ( ) Note: calls c3 (but does not allow to rename over existing files)Dhpath-directorydMove 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:( mode is not atomic-copy-delete fallback is inherently non-atomicsince this function calls 7 and ; as a fallback to C, file types that are not ., / or - may be ignoredfor (L mode, the destination will be deleted (not recursively) before movingThrows:[ if source file does not exist\) if output directory cannot be written to\% if source directory cannot be opened 5 if destination and source are the same file ( ) Throws in ' mode only:_ if destination already existsNotes:calls c3 (but does not allow to rename over existing files)calls getcwd4 in Overwrite mode if destination is a relative pathEhpath-directoryRead the given file *at once* into memory as a lazy ByteString. Symbolic links are followed, no sanity checks on file size or file type. File must exist. Uses Builders under the hood (hence lazy ByteString).Safety/reliability concerns:<the whole file is read into memory, this doesn't read lazilyThrows:^+ if file is not a regular file or a symlink\C if we cannot read the file or the directory containting it[ if the file does not existFhpath-directoryaOpen the given file as a filestream. Once the filestream is exits, the filehandle is cleaned up.Throws:^+ if file is not a regular file or a symlink\C if we cannot read the file or the directory containting it[ if the file does not existGhpath-directoryVWrite a given ByteString to a file, truncating the file beforehand. Follows symlinks.Throws:^+ if file is not a regular file or a symlink\C if we cannot read the file or the directory containting it[ if the file does not existHhpath-directory[Write a given lazy ByteString to a file, truncating the file beforehand. Follows symlinks.Throws:^+ if file is not a regular file or a symlink\C if we cannot read the file or the directory containting it[ if the file does not exist"Note: uses streamly under the hoodIhpath-directoryLAppend a given ByteString to a file. The file must exist. Follows symlinks.Throws:^+ if file is not a regular file or a symlink\C if we cannot read the file or the directory containting it[ if the file does not existJhpath-directory#Default permissions for a new file.Khpath-directory(Default permissions for a new directory.Lhpath-directory;Checks if the given file exists. Does not follow symlinks.+Only eNOENT is catched (and returns False).Mhpath-directory,Checks whether a file or folder is readable.BOnly eACCES, eROFS, eTXTBSY, ePERM are catched (and return False).Throws:[ if the file does not existNhpath-directory.Checks whether a file or folder is executable.BOnly eACCES, eROFS, eTXTBSY, ePERM are catched (and return False).Throws:[ if the file does not existRhpath-directorytGets 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:[ if directory does not exist^ if file type is wrong (file)^( if file type is wrong (symlink to file)^' if file type is wrong (symlink to dir)\ if directory cannot be openedShpath-directoryLike RF, but returns the filename only, instead of prepending the base path.Thpath-directoryYGet the file type of the file located at the given path. Does not follow symbolic links.Throws:[ if the file does not exist\* if any part of the path is not accessible 4hpath-directory source dirhpath-directory:destination (parent dirs are not automatically created)5hpath-directorythe old symlink filehpath-directorydestination file6hpath-directory source filehpath-directorydestination file=hpath-directoryprogramhpath-directory argumentsBhpath-directorydestination filehpath-directorypath the symlink points toDhpath-directory file to movehpath-directory destinationGhpath-directoryif Nothing, file must existHhpath-directoryif Nothing, file must existRhpath-directory dir to readShpath-directory dir to read5&'()*+,-./3012456789:;<=>?@ABCDEFGHIJKLMNOPQRST5,-./3012)*+&'(456789:;<=>?@ABCDEFGHIJKLMNOPQRSTd      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdeZ[fZ[gZ[hZ[iZ[jZ[kZlmZ[ncopq-hpath-directory-0.13.2-H5JKRJBFxKbLe3YV2UUzCY"System.Posix.RawFilePath.Directory)System.Posix.RawFilePath.Directory.ErrorscanOpenDirectory isWritabledoesDirectoryExist doesFileExisttoAbscanonicalizePathRecursiveFailureHintReadContentsFailedCreateDirFailedCopyFileFailedRecreateSymlinkFailedHPathIOExceptionSameFileDestinationInSourceRecursiveFailure isSameFileisDestinationInSourceisRecursiveFailureisReadContentsFailedisCreateDirFailedisCopyFileFailedisRecreateSymlinkFailedthrowFileDoesExistthrowDirDoesExist throwSameFilesameFilethrowDestinationInSource catchErrnorethrowErrnoAs handleIOError hideError bracketeer reactOnError$fExceptionHPathIOException$fEqRecursiveFailureHint$fShowRecursiveFailureHint$fEqHPathIOException$fShowHPathIOExceptionCopyModeStrict OverwriteRecursiveErrorMode FailEarlyCollectFailuresFileType Directory RegularFile SymbolicLink BlockDeviceCharacterDevice NamedPipeSocketcopyDirRecursiverecreateSymlinkcopyFileeasyCopy deleteFile deleteDirdeleteDirRecursive easyDeleteopenFile executeFilecreateRegularFile createDircreateDirIfMissingcreateDirRecursive createSymlink renameFilemoveFilereadFilereadFileStream writeFile writeFileL appendFile newFilePerms newDirPerms doesExist isReadable isExecutablegetModificationTimesetModificationTimesetModificationTimeHiRes getDirsFiles getDirsFiles' getFileType $fEqFileType$fShowFileTypebaseGHC.IO.ExceptionIOError(exceptions-0.10.4-622ySnQapwMAU2KS1exqorControl.Monad.Catch catchIOError.safe-exceptions-0.1.7.0-JIns11DhTTRKUEalvQYe6pControl.Exception.Safebracket unix-2.7.2.2!System.Posix.Directory.ByteString openDirStream NoSuchThingPermissionDeniedInvalidArgumentInappropriateType AlreadyExistsUnsatisfiedConstraintsForeign.C.ErroreXDEVUnsupportedOperationSystem.Posix.Files.ByteStringrename