pathtype-0.7: Type-safe replacement for System.FilePath etc

Safe HaskellSafe
LanguageHaskell98

System.Path.Directory

Contents

Description

This module provides type-safe access to directory manipulations.

It is designed to be imported instead of System.Directory. (It is intended to provide versions of functions from that module which have equivalent functionality but are more typesafe). System.Path is a companion module providing a type-safe alternative to System.FilePath.

You will typically want to import as follows:

import Prelude hiding (FilePath)
import System.Path
import System.Path.Directory
import System.Path.IO

Ben Moseley - (c) 2009

Synopsis

Actions on directories

getDirectoryContents :: AbsOrRelClass ar => DirPath ar -> IO [RelFileOrDir] Source

Retrieve the contents of a directory without any directory prefixes. In contrast to getDirectoryContents, exclude special directories "." and "..".

absDirectoryContents :: AbsOrRelClass ar => DirPath ar -> IO ([AbsDir], [AbsFile]) Source

Retrieve the contents of a directory path (which may be relative) as absolute paths

relDirectoryContents :: AbsOrRelClass ar => DirPath ar -> IO ([RelDir], [RelFile]) Source

Returns paths relative to the supplied (abs or relative) directory path. eg (for current working directory of /somewhere/cwd/):

show (relDirectoryContents "d/e/f/") == (["subDir1A","subDir1B"],
                                                     ["file1A","file1B"])

filesInDir :: AbsOrRelClass ar => DirPath ar -> IO [RelFile] Source

A convenient alternative to relDirectoryContents if you only want files.

dirsInDir :: AbsOrRelClass ar => DirPath ar -> IO [RelDir] Source

A convenient alternative to relDirectoryContents if you only want directories.

Pre-defined directories

Actions on files

renameFile :: (AbsOrRelClass ar1, AbsOrRelClass ar2) => FilePath ar1 -> FilePath ar2 -> IO () Source

copyFile :: (AbsOrRelClass ar1, AbsOrRelClass ar2) => FilePath ar1 -> FilePath ar2 -> IO () Source

Existence tests

Permissions

Timestamps