File: EasyFile.hs

package info (click to toggle)
haskell-easy-file 0.2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104 kB
  • sloc: haskell: 490; makefile: 4
file content (91 lines) | stat: -rw-r--r-- 2,546 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{-|
This is a module of cross-platform file handling for Unix\/Mac\/Windows.

The standard module "System.Directory" and "System.FilePath" have
following shortcomings:

* getModificationTime exists in "System.Directory". But getAccessTime,
  getChangeTime, getCreationTime do not exist.

* getModificationTime returns obsoleted type, 'ClockTime'. It should
  return modern type, 'UTCTime', I believe.

* Some file functions are missing. A function to tell the link counter,
  for instance.

* Path separator is not unified. Even though Windows accepts \'\/\' as a
  file separator, getCurrentDirectory in "System.Directory" returns \'\\\'
  as a file separator. So, we need to specify regular expression like
  this: \"[\/\\\\]foo[\/\\\\]bar[\/\\\\]baz\".

* getHomeDirectory returns @HOMEDRIVE@\/@HOMEPATH@ instead of the @HOME@
  environment variable on Windows.

This module aims to resolve these problems and provides:

* 'getModificationTime', 'getAccessTime', 'getChangeTime', and
  'getCreationTime'. They return 'UTCTime'.

* 'isSymlink', 'getLinkCount', and 'hasSubDirectories'.

* \'\/\' as the single 'pathSeparator'. For instance,
  'getCurrentDirectory' returns a path whose separator is \'\/\'
  even on Windows.

* 'getHomeDirectory2' which refers the @HOME@ environment variable.

* Necessary functions in "System.Directory" and "System.FilePath".

-}

module System.EasyFile (
  -- * Actions on directories
    createDirectory
  , createDirectoryIfMissing
  , removeDirectory
  , removeDirectoryRecursive
  , renameDirectory
  , getDirectoryContents
  , getCurrentDirectory
  , setCurrentDirectory
  -- * Pre-defined directories
  , getHomeDirectory
  , getHomeDirectory2 -- missing
  , getAppUserDataDirectory
  , getUserDocumentsDirectory
  , getTemporaryDirectory
  -- * Actions on files
  , removeFile
  , renameFile
  , copyFile
  , canonicalizePath
--   , makeRelativeToCurrentDirectory -- xxx
--   , findExecutable -- xxx
  -- * Existence tests
  , doesFileExist
  , doesDirectoryExist
  -- * Permissions
  , Permissions(..)
  , getPermissions
  , setPermissions
  , copyPermissions
  -- * Timestamps
  , getCreationTime
  , getChangeTime
  , getModificationTime
  , getAccessTime
  -- * Size
  , getFileSize
  , setFileSize
  -- * File\/directory information
  , isSymlink
  , getLinkCount
  , hasSubDirectories
  , module System.EasyFile.FilePath
  ) where

----------------------------------------------------------------

import System.EasyFile.Directory
import System.EasyFile.FilePath
import System.EasyFile.Missing