Lastik-0.6.3: A library for compiling programs in a variety of languages

System.Build.Directory

Contents

Description

A module for performing operations on directories.

Synopsis

Directory manipulating

chdirSource

Arguments

:: FilePath

The directory to change to.

-> IO a

The action to execute in the given directory.

-> IO a

The result of executing the given action.

Change to the given directory, then execute the given action, then change back to the original directory.

mkdirSource

Arguments

:: FilePath

The directory to create.

-> IO () 

Creates the given directory and its parents if it doesn't exist.

rmdirSource

Arguments

:: FilePath

The directory to remove.

-> IO () 

Removes the given directory recursively if it exists.

Directory archiving

archiveDirectoriesSource

Arguments

:: [(FilePath, FilePath)]

A list of base directories to change to and contents of that directory to archive.

-> RecursePredicate

The recursion predicate to search for files to archive.

-> FilterPredicate

The filter predicate to search for files to archive.

-> [ZipOption]

The options during the creation of the archive.

-> IO Archive

The constructed archive.

Create a zip archive by changing into directories and archiving the contents.

writeArchiveSource

Arguments

:: [(FilePath, FilePath)]

A list of base directories to change to and contents of that directory to archive.

-> RecursePredicate

The recursion predicate to search for files to archive.

-> FilterPredicate

The filter predicate to search for files to archive.

-> [ZipOption]

The options during the creation of the archive.

-> FilePath

The file to write the archive to.

-> IO () 

Writes a zip archive to a file.

writeHashArchiveSource

Arguments

:: [(FilePath, FilePath)]

A list of base directories to change to and contents of that directory to archive.

-> RecursePredicate

The recursion predicate to search for files to archive.

-> FilterPredicate

The filter predicate to search for files to archive.

-> [ZipOption]

The options during the creation of the archive.

-> FilePath

The file to write the archive to and the prefix name of the files containing the hashes.

-> IO () 

Writes a zip archive to a file then computes a MD5 and SHA1 hash and writes them to files with .md5 and .sha1 extensions.

Copying directories

copySource

Arguments

:: RecursePredicate

The recursion predicate to search for files in the source directory.

-> FilterPredicate

The filter predicate to search for files in the source directory.

-> FilePath

The source directory.

-> FilePath

The target directory.

-> IO () 

Copy the contents of a directory to another, perhaps trimming parent directories.

copylSource

Arguments

:: RecursePredicate

The recursion predicate to search for files in the source directory.

-> FilterPredicate

The filter predicate to search for files in the source directory.

-> Int

The number of parent directories to drop before copying to the target directory.

-> FilePath

The source directory.

-> FilePath

The target directory.

-> IO () 

Copy the contents of a directory to another, perhaps trimming parent directories.

dropRootSource

Arguments

:: FilePath

The file path to drop the parent directory from.

-> String

The file path without a parent directory.

Drops the parent directory of a given file path.

 dropRoot "/foo/bar" == "/bar"
 dropRoot "foo/bar" == "bar"
 dropRoot "foo" == ""
 dropRoot "" == ""

dropRoot'Source

Arguments

:: Int

The number of times to drop the parent directory.

-> FilePath

The file path to drop parent directories from.

-> FilePath

Te file path without parent directories.

Drops the parent directory (dropRoot) of a given file path multiple times.

 dropRoot' 0 "/foo/bar" == "/foo/bar"
 dropRoot' 1 "/foo/bar" == "/bar"
 dropRoot' 1 "foo/bar" == "bar"
 dropRoot' 2 "foo/bar" == ""
 dropRoot' 10 "foo/bar" == ""