!!݁7      !"#$%&'()*+,-./0123456 2016 Julian OspaldBSD3"Julian Ospald <hasufell@posteo.de> experimentalportableNoneWY$hpath-ioCopies 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  RegularFile,  SymbolicLink or  Directory.For  Overwrite 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 7 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: NoSuchThing# if source directory does not existPermissionDenied$ if source directory can't be opened84 if source and destination are the same file (9):. if destination is contained in source (9) Throws in  FailEarly RecursiveErrorMode only:PermissionDenied$ if output directory is not writableInvalidArgument, if source directory is wrong type (symlink)InappropriateType1 if source directory is wrong type (regular file) Throws in CollectFailures RecursiveErrorMode only:;e if any of the recursive operations that are not part of the top-directory sanity-checks fail (9) Throws in Strict CopyMode only: AlreadyExists if destination already existsNote: may call getcwd) (only if destination is a relative path)hpath-ioRecreate a symlink.In  Overwrite8 copy mode only files and empty directories are deleted.Safety/reliability concerns: Overwrite mode is inherently non-atomicThrows:InvalidArgument- if source file is wrong type (not a symlink)PermissionDenied) if output directory cannot be written toPermissionDenied% if source directory cannot be opened84 if source and destination are the same file (9) Throws in Strict mode only: AlreadyExists if destination already exists Throws in  Overwrite mode only:UnsatisfiedConstraints+ if destination file is non-empty directoryNotes:calls symlinkcalls getcwd6 in Overwrite mode (if destination is a relative path)hpath-ioCopies the given regular file to the given destination. Neither follows symbolic links, nor accepts them. For "copying" symbolic links, use  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  instead.In  Overwrite> copy mode only overwrites actual files, not directories. In Strict* mode the destination file must not exist.Safety/reliability concerns: Overwrite mode is not atomic when used on CharacterDevice], reads the "contents" and copies them to a regular file, which might take indefinitely when used on  BlockDevice, 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  NamedPipe, will hang indefinitelyThrows: NoSuchThing if source file does not exist NoSuchThing if source file is a a SocketPermissionDenied$ if output directory is not writablePermissionDenied$ if source directory can't be openedInvalidArgument4 if source file is wrong type (symlink or directory)84 if source and destination are the same file (9) Throws in Strict mode only: AlreadyExists if destination already existsNotes: may call getcwd6 in Overwrite mode (if destination is a relative path)hpath-ioCopies 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  for directoriesNote: may call getcwd6 in Overwrite mode (if destination is a relative path)hpath-ioDeletes the given file. Raises eISDIR8 if run on a directory. Does not follow symbolic links.Throws:InappropriateType for wrong file type (directory) NoSuchThing if the file does not existPermissionDenied if the directory cannot be readhpath-ioADeletes the given directory, which must be empty, never symlinks.Throws:InappropriateType+ for wrong file type (symlink to directory)InappropriateType# for wrong file type (regular file) NoSuchThing if directory does not existUnsatisfiedConstraints if directory is not emptyPermissionDenied. if we can't open or write to parent directory Notes: calls rmdirhpath-ioPDeletes the given directory recursively. Does not follow symbolic links. Tries / first before attemtping a recursive deletion.(On directory contents this behaves like 1 and thus will ignore any file type that is not  RegularFile,  SymbolicLink or  Directory.Safety/reliability concerns: not atomicexamines filetypes explicitlyThrows:InappropriateType+ for wrong file type (symlink to directory)InappropriateType# for wrong file type (regular file) NoSuchThing if directory does not existPermissionDenied. if we can't open or write to parent directoryhpath-ioDeletes 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 directorieshpath-ioeOpens a file appropriately by invoking xdg-open. The file type is not checked. This forks a process.hpath-ioBExecutes a program with the given arguments. This forks a process.hpath-ioMCreate an empty regular file at the given directory with the given filename.Throws:PermissionDenied) if output directory cannot be written to AlreadyExists if destination already exists NoSuchThing? if any of the parent components of the path do not existhpath-ioICreate an empty directory at the given directory with the given filename.Throws:PermissionDenied) if output directory cannot be written to AlreadyExists if destination already exists NoSuchThing? if any of the parent components of the path do not existhpath-ioICreate an empty directory at the given directory with the given filename.Throws:PermissionDenied) if output directory cannot be written to NoSuchThing? if any of the parent components of the path do not existhpath-ioCreate 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:PermissionDeniedO if any part of the path components do not exist and cannot be written to AlreadyExists= if destination already exists and is *not* a directory Note: calls getcwd% if the input path is a relative pathhpath-ioCreate a symlink.Throws:PermissionDenied) if output directory cannot be written to AlreadyExists# if destination file already exists NoSuchThing? if any of the parent components of the path do not exist Note: calls symlinkhpath-ionRename a given file with the provided filename. Destination and source must be on the same device, otherwise eXDEV 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: NoSuchThing if source file does not existPermissionDenied) if output directory cannot be written toPermissionDenied% if source directory cannot be openedUnsupportedOperation: if source and destination are on different devices AlreadyExists if destination already exists85 if destination and source are the same file (9) Note: calls rename3 (but does not allow to rename over existing files) hpath-iodMove 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: Overwrite mode is not atomic-copy-delete fallback is inherently non-atomicsince this function calls  and  as a fallback to , file types that are not  RegularFile,  SymbolicLink or  Directory may be ignoredfor  OverwriteL mode, the destination will be deleted (not recursively) before movingThrows: NoSuchThing if source file does not existPermissionDenied) if output directory cannot be written toPermissionDenied% if source directory cannot be opened85 if destination and source are the same file (9) Throws in Strict mode only: AlreadyExists if destination already existsNotes:calls rename3 (but does not allow to rename over existing files)calls getcwd4 in Overwrite mode if destination is a relative path!hpath-ioRead 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:InappropriateType+ if file is not a regular file or a symlinkPermissionDeniedC if we cannot read the file or the directory containting it NoSuchThing if the file does not exist"hpath-ioaOpen the given file as a filestream. Once the filestream is exits, the filehandle is cleaned up.Throws:InappropriateType+ if file is not a regular file or a symlinkPermissionDeniedC if we cannot read the file or the directory containting it NoSuchThing if the file does not exist#hpath-ioVWrite a given ByteString to a file, truncating the file beforehand. Follows symlinks.Throws:InappropriateType+ if file is not a regular file or a symlinkPermissionDeniedC if we cannot read the file or the directory containting it NoSuchThing if the file does not exist$hpath-io[Write a given lazy ByteString to a file, truncating the file beforehand. Follows symlinks.Throws:InappropriateType+ if file is not a regular file or a symlinkPermissionDeniedC if we cannot read the file or the directory containting it NoSuchThing if the file does not exist"Note: uses streamly under the hood%hpath-ioLAppend a given ByteString to a file. The file must exist. Follows symlinks.Throws:InappropriateType+ if file is not a regular file or a symlinkPermissionDeniedC if we cannot read the file or the directory containting it NoSuchThing if the file does not exist&hpath-io;Checks if the given file exists. Does not follow symlinks.+Only eNOENT is catched (and returns False).'hpath-ioRChecks if the given file exists and is not a directory. Does not follow symlinks.+Only eNOENT is catched (and returns False).(hpath-ioNChecks if the given file exists and is a directory. Does not follow symlinks.+Only eNOENT is catched (and returns False).)hpath-io,Checks whether a file or folder is readable.BOnly eACCES, eROFS, eTXTBSY, ePERM are catched (and return False).Throws: NoSuchThing if the file does not exist*hpath-io,Checks whether a file or folder is writable.BOnly eACCES, eROFS, eTXTBSY, ePERM are catched (and return False).Throws: NoSuchThing if the file does not exist+hpath-io.Checks whether a file or folder is executable.BOnly eACCES, eROFS, eTXTBSY, ePERM are catched (and return False).Throws: NoSuchThing if the file does not exist,hpath-ioWChecks whether the directory at the given path exists and can be opened. This invokes  openDirStream which follows symlinks.0hpath-iotGets 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: NoSuchThing if directory does not existInappropriateType if file type is wrong (file)InappropriateType( if file type is wrong (symlink to file)InappropriateType' if file type is wrong (symlink to dir)PermissionDenied if directory cannot be opened<8 if a filename could not be parsed (should never happen)1hpath-ioLike 0F, but returns the filename only, instead of prepending the base path.2hpath-ioYGet the file type of the file located at the given path. Does not follow symbolic links.Throws: NoSuchThing if the file does not existPermissionDenied* if any part of the path is not accessible3hpath-ioApplies realpath on the given path.Throws: NoSuchThing- if the file at the given path does not exist NoSuchThing if the symlink is broken<- if realpath does not return an absolute path4hpath-ioJConverts 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 it5hpath-io_Helper function to use the Path library without buying into the Path type too much. This uses = under the hood and may throw <.Throws:<M if the bytestring could neither be parsed as relative or absolute Path6hpath-io2Convenience function to open the path as a handle.4If the file does not exist, it will be created with  newFilePerms.Throws:<M if the bytestring could neither be parsed as relative or absolute Path hpath-io source dirhpath-io:destination (parent dirs are not automatically created)hpath-iothe old symlink filehpath-iodestination filehpath-io source filehpath-iodestination filehpath-ioprogramhpath-io argumentshpath-iodestination filehpath-iopath the symlink points to hpath-io file to movehpath-io destination#hpath-ioif Nothing, file must exist$hpath-ioif Nothing, file must exist0hpath-io dir to read1hpath-io dir to readR   >?@ABC7DEFGHIJKLMN98:;OPQRS !"#$%&'()*+,-./01234567    !"#$%&'()*+,-./0123456T      !"#$%&'()*+,-./0123456789:;<;=;>;?;@ABCABD;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z[&hpath-io-0.13.0-LiULgoCuI6t2317U9R6hvPHPath.IO-hpath-directory-0.13.0-ARmQk2bJU9C7lyENXNzQIB"System.Posix.RawFilePath.Directory newDirPerms newFilePermsSocket NamedPipeCharacterDevice BlockDevice SymbolicLink RegularFile DirectoryFileTypeCollectFailures FailEarlyRecursiveErrorMode OverwriteStrictCopyModecopyDirRecursiverecreateSymlinkcopyFileeasyCopy deleteFile deleteDirdeleteDirRecursive easyDeleteopenFile executeFilecreateRegularFile createDircreateDirIfMissingcreateDirRecursive createSymlink renameFilemoveFilereadFilereadFileStream writeFile writeFileL appendFile doesExist doesFileExistdoesDirectoryExist isReadable isWritable isExecutablecanOpenDirectorygetModificationTimesetModificationTimesetModificationTimeHiRes getDirsFiles getDirsFiles' getFileTypecanonicalizePathtoAbswithRawFilePath withHandle)System.Posix.RawFilePath.Directory.ErrorsthrowDestinationInSourceSameFileHPathIOExceptionDestinationInSourceRecursiveFailure#hpath-0.11.0-8mE7Iy68n332LVQAKeW2YxHPathPathParseExceptionparseAny reactOnError bracketeer hideError handleIOErrorrethrowErrnoAs catchErrnosameFile throwSameFilethrowDirDoesExistthrowFileDoesExistisRecreateSymlinkFailedisCopyFileFailedisCreateDirFailedisReadContentsFailedisRecursiveFailureisDestinationInSource isSameFileRecursiveFailureHintReadContentsFailedCreateDirFailedCopyFileFailedRecreateSymlinkFailed