Agda-2.2.4: A dependently typed functional programming language and proof assistantSource codeContentsIndex
Agda.Utils.FileName
Description
Operations on file names.
Synopsis
splitFilePath :: FilePath -> (FilePath, String, String)
splitExt :: FilePath -> (String, String)
setExtension :: String -> FilePath -> FilePath
splitPath :: FilePath -> [FilePath]
unsplitPath :: [FilePath] -> FilePath
dropDirectory :: Integral i => i -> FilePath -> FilePath
nubFiles :: [FilePath] -> IO [FilePath]
nameChar :: Gen Char
name :: Gen FilePath
nonEmptyName :: Gen FilePath
path :: Gen FilePath
pathOfLength :: Int -> Gen FilePath
Documentation
splitFilePath :: FilePath -> (FilePath, String, String)Source
splitExt :: FilePath -> (String, String)Source
The extension includes the dot
setExtension :: String -> FilePath -> FilePathSource
Change the extension of a filename
splitPath :: FilePath -> [FilePath]Source
Breaks up a path (possibly including a file) into a list of drives/directories (with the file at the end).
unsplitPath :: [FilePath] -> FilePathSource
The moral inverse of splitPath.
dropDirectory :: Integral i => i -> FilePath -> FilePathSource

Given a path (not including a file) dropDirectory n removes the last n directories in the path (if any).

Precondition: n >= 0, and the path has to be absolute.

nubFiles :: [FilePath] -> IO [FilePath]Source

Removes duplicate file names from the list. Nonexisting files are compared by name only. Two existing files are considered to be equal if

  • canonicalizePath returns the same canonical path for them,
  • and they have the same modification time.

Nonexisting and existing files are not compared.

Note that in the case of existing files the returned file names are canonicalised.

The modification time test for existing files is included since the first method may not always give correct results. I would want to check the files' sizes instead of their modification times, but System.Directory does not contain a function for querying the size of a file.

This function is of course prone to errors if files are changed while it is running.

To summarise: There are no guarantees that this function gives correct results. Do not use it for mission-critical code.

nameChar :: Gen CharSource
Generates a character distinct from slash (it may be '.').
name :: Gen FilePathSource
Generates a possibly empty string of nameChars.
nonEmptyName :: Gen FilePathSource
Generates a non-empty string of nameChars.
path :: Gen FilePathSource
Generates a possibly empty path (without any drive).
pathOfLength :: Int -> Gen FilePathSource
pathOfLength n generates a path which contains n + 1 slashes and starts and ends with a slash.
Produced by Haddock version 2.4.2