System.IO.HVFS.Utils

MissingH-1.4.1.0: Large utility library

Copyright | Copyright (C) 2004-2011 John Goerzen
License | BSD3
Maintainer | John Goerzen <jgoerzen@complete.org>
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell98

System.IO.HVFS.Utils

Description

This module provides various helpful utilities for dealing filesystems.

Written by John Goerzen, jgoerzen@complete.org

To operate on your system's main filesystem, just pass SystemFS as the first parameter to these functions.

Synopsis

- recurseDir :: HVFS a => a -> FilePath -> IO [FilePath]
- recurseDirStat :: HVFS a => a -> FilePath -> IO [(FilePath, HVFSStatEncap)]
- recursiveRemove :: HVFS a => a -> FilePath -> IO ()
- lsl :: HVFS a => a -> FilePath -> IO String
- data SystemFS = SystemFS

# Documentation

recurseDir :: HVFS a => a -> FilePath -> IO [FilePath] #

Obtain a recursive listing of all files/directories beneath the specified directory. The traversal is depth-first and the original item is always present in the returned list.

If the passed value is not a directory, the return value be only that value.

The "." and ".." entries are removed from the data returned.

recurseDirStat :: HVFS a => a -> FilePath -> IO [(FilePath, HVFSStatEncap)] #

Like `recurseDir`, but return the stat() (System.Posix.Files.FileStatus) information with them. This is an optimization if you will be statting files yourself later.

The items are returned lazily.

WARNING: do not change your current working directory until you have consumed all the items. Doing so could cause strange effects.

Alternatively, you may wish to pass an absolute path to this function.

recursiveRemove :: HVFS a => a -> FilePath -> IO () #

Removes a file or a directory. If a directory, also removes all its child files/directories.

lsl :: HVFS a => a -> FilePath -> IO String #

Provide a result similar to the command ls -l over a directory.

Known bug: setuid bit semantics are inexact compared with standard ls.

data SystemFS #

Constructors

SystemFS |

Instances

Eq SystemFS # |
Instance details Defined in System.IO.HVFS Methods (==) :: SystemFS -> SystemFS -> Bool # (/=) :: SystemFS -> SystemFS -> Bool #
Show SystemFS # |
Instance details Defined in System.IO.HVFS Methods showsPrec :: Int -> SystemFS -> ShowS # show :: SystemFS -> String # showList :: [SystemFS] -> ShowS #
HVFSOpenable SystemFS # |
Instance details Defined in System.IO.HVFS Methods vOpen :: SystemFS -> FilePath -> IOMode -> IO HVFSOpenEncap # vReadFile :: SystemFS -> FilePath -> IO String # vWriteFile :: SystemFS -> FilePath -> String -> IO () # vOpenBinaryFile :: SystemFS -> FilePath -> IOMode -> IO HVFSOpenEncap #
HVFS SystemFS # |
Instance details Defined in System.IO.HVFS Methods vGetCurrentDirectory :: SystemFS -> IO FilePath # vSetCurrentDirectory :: SystemFS -> FilePath -> IO () # vGetDirectoryContents :: SystemFS -> FilePath -> IO [FilePath] # vDoesFileExist :: SystemFS -> FilePath -> IO Bool # vDoesDirectoryExist :: SystemFS -> FilePath -> IO Bool # vDoesExist :: SystemFS -> FilePath -> IO Bool # vCreateDirectory :: SystemFS -> FilePath -> IO () # vRemoveDirectory :: SystemFS -> FilePath -> IO () # vRenameDirectory :: SystemFS -> FilePath -> FilePath -> IO () # vRemoveFile :: SystemFS -> FilePath -> IO () # vRenameFile :: SystemFS -> FilePath -> FilePath -> IO () # vGetFileStatus :: SystemFS -> FilePath -> IO HVFSStatEncap # vGetSymbolicLinkStatus :: SystemFS -> FilePath -> IO HVFSStatEncap # vGetModificationTime :: SystemFS -> FilePath -> IO ClockTime # vRaiseError :: SystemFS -> IOErrorType -> String -> Maybe FilePath -> IO c # vCreateSymbolicLink :: SystemFS -> FilePath -> FilePath -> IO () # vReadSymbolicLink :: SystemFS -> FilePath -> IO FilePath # vCreateLink :: SystemFS -> FilePath -> FilePath -> IO () #