úΣ„ž©O      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN© 2016 2017 Mark Karpov BSD 3 clause$Mark Karpov <markkarpov92@gmail.com> experimentalportableNone9;DLRBClass of things (OYs) that can be canonicalized, made absolute, and made relative to a some base directory.&Type of absolute version of the given path.&Type of relative version of the given path.|Make a path absolute and remove as many indirections from it as possible. Indirections include the two special directories . and ..a, as well as any symbolic links. The input path need not point to an existing file or directory.Note,: if you require only an absolute path, use U instead. Most programs need not care about whether a path contains symbolic links.ÿ,Due to the fact that symbolic links are dependent on the state of the existing filesystem, the function can only make a conservative, best-effort attempt. Nevertheless, if the input path points to an existing file or directory, then the output path shall also point to the same file or directory.ÜFormally, symbolic links are removed from the longest prefix of the path that still points to an existing file. The function is not atomic, therefore concurrent changes in the filesystem may lead to incorrect results.Š(Despite the name, the function does not guarantee canonicity of the returned path due to the presence of hard links, mount points, etc.) Known bug(s)<: on Windows, the function does not resolve symbolic links./Please note that before version 1.2.3.0 of the  directoryJ package, this function had unpredictable behavior on non-existent paths.fMake a path absolute by prepending the current directory (if it isn't already absolute) and applying P to the result.{If the path is already absolute, the operation never fails. Otherwise, the operation may fail with the same exceptions as $.*Make a path relative to a given directory.2Make a path relative to current working directory.gAction returned by the traversal handler function. The action controls how the traversal will proceed.!Finish the entire walk altogether3List of sub-directories to exclude from descending dir creates a new directory dirO which is initially empty, or as near to empty as the operating system allows.The operation may fail with:isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES]isAlreadyExistsError /  AlreadyExists: The operand refers to a directory that already exists.  [EEXIST] HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument. The operand is not a valid directory name. [ENAMETOOLONG, ELOOP] NoSuchThing& There is no path to the directory. [ENOENT, ENOTDIR]ResourceExhaustedˆ Insufficient resources (virtual memory, process file descriptors, physical disk space, etc.) are available to perform the operation.  [EDQUOT, ENOSPC, ENOMEM, EMLINK]InappropriateType8 The path refers to an existing non-directory object. [EEXIST] parents dir creates a new directory dir0 if it doesn't exist. If the first argument is QK the function will also create all parent directories if they are missing.sEnsure that a directory exists creating it and its parent directories if necessary. This is just a handy shortcut: #ensureDir = createDirIfMissing True dir removes an existing directory dirÿ«. The implementation may specify additional constraints which must be satisfied before a directory can be removed (e.g. the directory has to be empty, or may not be in use by other processes). It is not legal for an implementation to partially remove a directory unless the entire directory is removed. A conformant implementation need not support directory removal in all situations (e.g. removal of the root directory).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument. The operand is not a valid directory name. [ENAMETOOLONG, ELOOP]R /  NoSuchThing! The directory does not exist. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY, ENOTEMPTY, EEXIST]UnsupportedOperationB The implementation does not support removal in this situation. [EINVAL]InappropriateType; The operand refers to an existing non-directory object.  [ENOTDIR] dir removes an existing directory dir… together with its contents and sub-directories. Within this directory, symbolic links are removed without affecting their targets. old new1 changes the name of an existing directory from old to new . If the new= directory already exists, it is atomically replaced by the old directory. If the new directory is neither the old directory nor an alias of the old$ directory, it is removed as if by Ð. A conformant implementation need not support renaming directories in all situations (e.g. renaming to an existing directory, or across different physical devices), but the constraints must be documented.On Win32 platforms,  renameDir fails if the new directory already exists.The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument1 Either operand is not a valid directory name. [ENAMETOOLONG, ELOOP]R /  NoSuchThingM The original directory does not exist, or there is no path to the target. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]ResourceExhaustedB Insufficient resources are available to perform the operation.  [EDQUOT, ENOSPC, ENOMEM, EMLINK]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY, ENOTEMPTY, EEXIST]UnsupportedOperationC The implementation does not support renaming in this situation. [EINVAL, EXDEV]InappropriateType; Either path refers to an existing non-directory object. [ENOTDIR, EISDIR] dir returns a list of all entries in dir without the special entries (. and ..). Entries are not sorted.The operation may fail with: HardwareFault* A physical I/O error has occurred. [EIO]InvalidArgument2 The operand is not a valid directory name. [ENAMETOOLONG, ELOOP]R /  NoSuchThing% The directory does not exist. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedI The process has insufficient privileges to perform the operation. [EACCES]ResourceExhaustedF Insufficient resources are available to perform the operation. [EMFILE, ENFILE]InappropriateType< The path refers to an existing non-directory object.  [ENOTDIR] Similar to 1, but recursively traverses every sub-directory excluding symbolic linksZ, and returns all files and directories found. This can fail with the same exceptions as .Note: before version 1.3.0", this function followed symlinks. #Copies a directory recursively. It does notý follow symbolic links and preserves permissions when possible. If the destination directory already exists, new files and sub-directories complement its structure, possibly overwriting old files if they happen to have the same name as the new ones.Note: before version 1.3.0", this function followed symlinks.! The same as   , but it does notœ preserve directory permissions. This may be useful, for example, if the directory you want to copy is read-only , but you want your copy to be editable.Note: before version 1.3.0", this function followed symlinks.SGeneric version of  Q. The first argument controls whether to preserve directory permissions or not. Does not follow symbolic links.Note: before version 1.3.0", this function followed symlinks."ÿTraverse a directory tree using depth first pre-order traversal, calling a handler function at each directory node traversed. The absolute paths of the parent directory, sub-directories and the files in the directory are provided as arguments to the handler.ÚThe function is capable of detecting and avoiding traversal loops in the directory tree. Note that the traversal follows symlinks by default, an appropriate traversal handler can be used to avoid that when necessary.# Similar to " but accepts a Tr-returning output writer as well. Values returned by the output writer invocations are accumulated and returned.žBoth, the descend handler as well as the output writer can be used for side effects but keep in mind that the output writer runs before the descend handler.$9Obtain the current working directory as an absolute path.ÿ In a multithreaded program, the current working directory is a global state shared among all threads of the process. Therefore, when performing filesystem operations from multiple threads, it is highly recommended to use absolute rather than relative paths (see: ).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]R or  NoSuchThing8 There is no path referring to the working directory. [EPERM, ENOENT, ESTALE...]isPermissionError or PermissionDeniedE The process has insufficient privileges to perform the operation. [EACCES]ResourceExhausted@ Insufficient resources are available to perform the operation.UnsupportedOperationB The operating system has no notion of current working directory.%/Change the working directory to the given path.ÿ In a multithreaded program, the current working directory is a global state shared among all threads of the process. Therefore, when performing filesystem operations from multiple threads, it is highly recommended to use absolute rather than relative paths (see: ).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument. The operand is not a valid directory name. [ENAMETOOLONG, ELOOP]R or  NoSuchThing! The directory does not exist. [ENOENT, ENOTDIR]isPermissionError or PermissionDeniedE The process has insufficient privileges to perform the operation. [EACCES]UnsupportedOperation{ The operating system has no notion of current working directory, or the working directory cannot be dynamically changed.InappropriateType8 The path refers to an existing non-directory object.  [ENOTDIR]&Run an U• action with the given working directory and restore the original working directory afterwards, even if the given action fails due to an exception.3The operation may fail with the same exceptions as $ and %.')Return the current user's home directory.°The directory returned is expected to be writable by the current user, but note that it isn't generally considered good practice to store application-specific data here; use ( instead. On Unix, ' returns the value of the HOMEh environment variable. On Windows, the system is queried for a suitable path; a typical path might be  C:/Users/<user>.The operation may fail with:UnsupportedOperation7 The operating system has no notion of home directory.RN The home directory for the current user does not exist, or cannot be found.(oObtain the path to a special directory for storing user-specific application data (traditional Unix location).ŠThe argument is usually the name of the application. Since it will be integrated into the path, it must consist of valid path characters."On Unix-like systems, the path is ~/.<app>.On Windows, the path is  %APPDATA%/<app> (e.g.  C:/Users/<user>/AppData/Roaming/<app>)™Note: the directory may not actually exist, in which case you would need to create it. It is expected that the parent directory exists and is writable.The operation may fail with:UnsupportedOperationQ The operating system has no notion of application-specific data directory.RR The home directory for the current user does not exist, or cannot be found.)-Return the current user's document directory.°The directory returned is expected to be writable by the current user, but note that it isn't generally considered good practice to store application-specific data here; use ( instead. On Unix, ) returns the value of the HOMEh environment variable. On Windows, the system is queried for a suitable path; a typical path might be  C:/Users/<user> /Documents.The operation may fail with:UnsupportedOperation; The operating system has no notion of document directory.RR The document directory for the current user does not exist, or cannot be found.*1Return the current directory for temporary files. On Unix, * returns the value of the TMPDIR environment variable or "/tmp" if the variable isn't defined. On Windows, the function checks for the existence of environment variables in the following order and uses the first path found:TMP environment variable.TEMP environment variable.!USERPROFILE environment variable.The Windows directoryThe operation may fail with:UnsupportedOperation< The operating system has no notion of temporary directory.4The function doesn't verify whether the path exists.+ˆObtain the paths to special directories for storing user-specific application data, configuration, and cache files, conforming to the  Fhttp://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG Base Directory Specification. Compared with (d, this function provides a more fine-grained hierarchy as well as greater flexibility for the user.0It also works on Windows, although in that case XdgData and  XdgConfig! will map to the same directory.fNote: The directory may not actually exist, in which case you would need to create it with file mode 700% (i.e. only accessible by the owner).BNote also: this is a piece of conditional API, only available if directory-1.2.3.0 or later is used.,IAppend stringly-typed path to an absolute path and then canonicalize it.- The same as ,%, but uses current working directory.. The same as ,, but for directories./ The same as .%, but uses current working directory.00 file3 removes the directory entry for an existing file file, where file¾ is not itself a directory. The implementation may specify additional constraints which must be satisfied before a file can be removed (e.g. the file may not be in use by other processes).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument) The operand is not a valid file name. [ENAMETOOLONG, ELOOP]R /  NoSuchThing The file does not exist. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY]InappropriateType0 The operand refers to an existing directory. [EPERM, EINVAL]11 old new: changes the name of an existing file system object from old to new . If the new: object already exists, it is atomically replaced by the oldå object. Neither path may refer to an existing directory. A conformant implementation need not support renaming files in all situations (e.g. renaming across different physical devices), but the constraints must be documented.The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument, Either operand is not a valid file name. [ENAMETOOLONG, ELOOP]R /  NoSuchThingH The original file does not exist, or there is no path to the target. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]ResourceExhaustedB Insufficient resources are available to perform the operation.  [EDQUOT, ENOSPC, ENOMEM, EMLINK]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY]UnsupportedOperationC The implementation does not support renaming in this situation. [EXDEV]InappropriateType0 Either path refers to an existing directory. ,[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]22 old new copies the existing file from old to new . If the new7 file already exists, it is atomically replaced by the oldM file. Neither path may refer to an existing directory. The permissions of old are copied to new, if possible.3YGiven an executable file name, search for such file in the directories listed in system PATH=. The returned value is the path to the found executable or VC if an executable with the given name was not found. For example (3" "ghc") gives you the path to GHC.The path returned by 37 corresponds to the program that would be executed by D when passed the same string (as a RawCommand, not a ShellCommand). On Windows, 3 calls the Win32 function  SearchPathD, which may search other places before checking the directories in PATHˆ. Where it actually searches depends on registry settings, but notably includes the directory containing the current executable. See  5http://msdn.microsoft.com/en-us/library/aa365527.aspx for more details.4?Search through the given set of directories for the given file.5wSearch through the given set of directories for the given file and return a list of paths where the given file exists.6¿Search through the given set of directories for the given file and with the given property (usually permissions) and return a list of paths where the given file exists and has the property.7+Check if the given path is a symbolic link.80Use a temporary file that doesn't already exist.~Creates a new temporary file inside the given directory, making use of the template. The temporary file is deleted after use.9%Create and use a temporary directory.ˆCreates a new temporary directory inside the given directory, making use of the template. The temporary directory is deleted after use.:LCreate and use a temporary file in the system standard temporary directory.Behaves exactly the same as 8G, except that the parent temporary directory will be that returned by *.;QCreate and use a temporary directory in the system standard temporary directory.Behaves exactly the same as 9G, except that the parent temporary directory will be that returned by *.<)The function creates a temporary file in rwX mode. The created file isn't deleted automatically, so you need to delete it manually.XThe file is created with permissions such that only the current user can read/write it.ÿ;With some exceptions (see below), the file will be created securely in the sense that an attacker should not be able to cause openTempFile to overwrite another file on the filesystem using your credentials, by putting symbolic links (on Unix) in the place where the temporary file is to be created. On Unix the O_CREAT and O_EXCL7 flags are used to prevent this attack, but note that O_EXCL| is sometimes not supported on NFS filesystems, so if you rely on this behaviour it is best to use local filesystems only.=Like <t, but opens the file in binary mode. On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLFÿ. This is usually what you want with text files. With binary files this is undesirable; also, as usual under Microsoft operating systems, text mode treats control-Z as EOF. Binary mode turns off all special treatment of end-of-line and end-of-file characters.>tCreate a temporary directory. The created directory isn't deleted automatically, so you need to delete it manually.]The directory is created with permissions such that only the current user can read/write it.?The operation ? returns Q: if the argument file exists and is not a directory, and W otherwise.@The operation @ returns Q_ if the argument file exists and is either a directory or a symbolic link to a directory, and W otherwise.A8Check if there is a file or directory on specified path.B&If argument of the function throws a , VV is returned (other exceptions propagate). Otherwise the result is returned inside a X.C The same as B, but ignores result.DThe D> operation returns the permissions for the file or directory.The operation may fail with:isPermissionError> if the user is not permitted to access the permissions; orR) if the file or directory does not exist.EThe E; operation sets the permissions for the file or directory.The operation may fail with:isPermissionError; if the user is not permitted to set the permissions; orR) if the file or directory does not exist.FuSet permissions for the object found on second given path so they match permissions of the object on the first path.GAObtain the time at which the file or directory was last accessed.The operation may fail with:isPermissionError< if the user is not permitted to read the access time; orR) if the file or directory does not exist.‚Caveat for POSIX systems: This function returns a timestamp with sub-second resolution only if this package is compiled against  unix-2.6.0.06 or later and the underlying filesystem supports them.=Note: this is a piece of conditional API, only available if directory-1.2.3.0 or later is used.HAChange the time at which the file or directory was last accessed.The operation may fail with:isPermissionError= if the user is not permitted to alter the access time; orR) if the file or directory does not exist.Some caveats for POSIX systems:Not all systems support  utimensat¸, in which case the function can only emulate the behavior by reading the modification time and then setting both the access and modification times together. On systems where  utimensatN is supported, the access time is set atomically with nanosecond precision.!If compiled against a version of unix prior to 2.7.0.0¥, the function would not be able to set timestamps with sub-second resolution. In this case, there would also be loss of precision in the modification time.=Note: this is a piece of conditional API, only available if directory-1.2.3.0 or later is used.IAChange the time at which the file or directory was last modified.The operation may fail with:isPermissionErrorC if the user is not permitted to alter the modification time; orR) if the file or directory does not exist.Some caveats for POSIX systems:Not all systems support  utimensat², in which case the function can only emulate the behavior by reading the access time and then setting both the access and modification times together. On systems where  utimensatT is supported, the modification time is set atomically with nanosecond precision.!If compiled against a version of unix prior to 2.7.0.0Ÿ, the function would not be able to set timestamps with sub-second resolution. In this case, there would also be loss of precision in the access time.=Note: this is a piece of conditional API, only available if directory-1.2.3.0 or later is used.JAObtain the time at which the file or directory was last modified.The operation may fail with:isPermissionErrorB if the user is not permitted to read the modification time; orR) if the file or directory does not exist.‚Caveat for POSIX systems: This function returns a timestamp with sub-second resolution only if this package is compiled against  unix-2.6.0.06 or later and the underlying filesystem supports them.YLift action in U that takes Z9 into action in slightly more abstract monad that takes O.[ Similar to Y for functions with arity 2.\ Similar to [8, but allows to pass second argument of arbitrary type.]6Perform an action ignoring IO exceptions it may throw.DCreate its parents too?*The path to the directory you want to makeOld nameNew nameDirectory to listSub-directories and filesDirectory to listSub-directories and files Source Destination!Source DestinationS)Should we preserve directory permissions?Source Destination" Handler (dir -> subdirs -> files -> ) Directory where traversal begins#Descend handler (dir -> subdirs -> files -> %), descend the whole tree if omittedOutput writer (dir -> subdirs -> files -> o) Directory where traversal beginsBAccumulation of outputs generated by the output writer invocations$%&Directory to execute inAction to be executed'(/Name of application (used in path construction))*+Which special directory1A relative path that is appended to the path; if V, the base path is returned,Base directoryPath to resolve-Path to resolve.Base directoryPath to resolve/Path to resolve01Original location New location2Original locationWhere to put copy3Executable file namePath to found executable4Set of directories to search inFilename of interest Absolute path to file (if found)5Set of directories to search inFilename of interest!Absolute paths to all found files6How to test the filesSet of directories to search inFilename of interest!Absolute paths to all found files78Directory to create the file inFile name template, see <Callback that can use the file9Directory to create the file inDirectory name template, see <#Callback that can use the directory:File name template, see <Callback that can use the file;Directory name template, see <#Callback that can use the directory<Directory to create file inPFile name template; if the template is "foo.ext" then the created file will be  "fooXXX.ext" where XXX is some random numberName of created file and its ^=Directory to create file inFile name template, see <Name of created file and its ^>Directory to create file inDirectory name template, see <#Name of created temporary directory?@ABCDEFFrom where to copyWhat to modifyGHIJYOriginal actionO argument Lifted action[Original actionFirst O argumentSecond O argument\Original actionFirst O argumentSecond argument]KLK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJO !"#$%&'()* +,-./0123456789:;<=>?@ABC DEFGHIJ< !S"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJY[\]KL_      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab`cd]^e`cf]^g`chi`jklmn`opq$path-io-1.3.2-4Ra3lvrhoaB609gqpIA6eJPath.IOSystem.Process createProcessSystem.IO.ErrordoesNotExistErrorTypedirectory-1.3.0.0System.DirectorysetOwnerSearchablesetOwnerExecutablesetOwnerWritablesetOwnerReadableemptyPermissions searchable executablewritablereadable PermissionsXdgCache XdgConfigXdgData XdgDirectoryAnyPathAbsPathRelPathcanonicalizePath makeAbsolute makeRelativemakeRelativeToCurrentDir WalkAction WalkFinish WalkExclude createDircreateDirIfMissing ensureDir removeDirremoveDirRecur renameDirlistDir listDirRecur copyDirRecur copyDirRecur'walkDir walkDirAccum getCurrentDir setCurrentDirwithCurrentDir getHomeDirgetAppUserDataDirgetUserDocsDir getTempDir getXdgDir resolveFile resolveFile' resolveDir resolveDir' removeFile renameFilecopyFilefindExecutablefindFile findFiles findFilesWith isSymlink withTempFile withTempDirwithSystemTempFilewithSystemTempDir openTempFileopenBinaryTempFile createTempDir doesFileExist doesDirExistisLocationOccupiedforgivingAbsenceignoringAbsencegetPermissionssetPermissionscopyPermissions getAccessTime setAccessTimesetModificationTimegetModificationTime $fAnyPathPath$fAnyPathPath0$fEqWalkAction$fShowWalkAction!path-0.6.1-CanJ1NVqKbWKHPWlp2BDdM Path.InternalPathfilepath-1.4.1.1System.FilePath.Posix normaliseghc-prim GHC.TypesTruebaseisDoesNotExistErrorcopyDirRecurGenGHC.BaseMonoidIONothingFalseJustliftDGHC.IOFilePathliftD2liftD2'ignoringIOErrorsGHC.IO.Handle.TypesHandle