ghcup-0.1.18.0: ghc toolchain installer
Safe HaskellNone
LanguageHaskell2010

GHCup.Prelude.File

Synopsis

Documentation

mergeFileTree Source #

Arguments

:: (MonadMask m, MonadAsync m, MonadReader env m, HasDirs env, HasLog env, MonadCatch m) 
=> GHCupPath

source base directory from which to install findFiles

-> InstallDirResolved

destination base dir

-> Tool 
-> GHCTargetVersion 
-> (FilePath -> FilePath -> m ())

file copy operation

-> Excepts '[MergeFileTreeError] m () 

Merge one file tree to another given a copy operation.

Records every successfully installed file into the destination returned by recordedInstallationFile.

If any copy operation fails, the record file is deleted, as well as the partially installed files.

getDirectoryContentsRecursiveDFS :: (MonadCatch m, MonadAsync m, MonadMask m) => GHCupPath -> SerialT m FilePath Source #

List all the files in a directory and all subdirectories.

The order places files in sub-directories after all the files in their parent directories. The list is generated lazily so is not well defined if the source directory structure changes before the list is used.

depth first

isBrokenSymlink :: FilePath -> IO Bool Source #

Checks whether the binary is a broken link.

copyFile Source #

Arguments

:: FilePath

source file

-> FilePath

destination file

-> Bool

fail if file exists

-> IO () 

deleteFile :: FilePath -> IO () Source #

Deletes the given file. Raises eISDIR if run on a directory. Does not follow symbolic links.

Throws:

  • InappropriateType for wrong file type (directory)
  • NoSuchThing if the file does not exist
  • PermissionDenied if the directory cannot be read

Notes: calls unlink

createDirRecursive' :: FilePath -> IO () Source #

More permissive version of createDirRecursive. This doesn't error when the destination is a symlink to a directory.

recycleFile :: (MonadIO m, MonadMask m, MonadReader env m, HasDirs env) => FilePath -> m () Source #

rmFile :: (MonadIO m, MonadMask m) => FilePath -> m () Source #

exeExt :: String Source #

The file extension for executables.

exeExt' :: ByteString Source #

The file extension for executables.

getLinkTarget :: FilePath -> IO FilePath Source #

On unix, we can use symlinks, so we just get the symbolic link target.

On windows, we have to emulate symlinks via shims, see createLink.

pathIsLink :: FilePath -> IO Bool Source #

Checks whether the path is a link.

rmLink :: (MonadReader env m, HasDirs env, MonadIO m, MonadMask m) => FilePath -> m () Source #

createLink Source #

Arguments

:: (MonadMask m, MonadThrow m, HasLog env, MonadIO m, MonadReader env m, HasDirs env, MonadUnliftIO m, MonadFail m) 
=> FilePath

path to the target executable

-> FilePath

path to be created

-> m () 

Creates a symbolic link on unix and a fake symlink on windows for executables, which: 1. is a shim exe 2. has a corresponding .shim file in the same directory that contains the target

This overwrites previously existing files.

On windows, this requires that ensureGlobalTools was run beforehand.