Difference between revisions of "Directory"
Bas Lijnse (talk | contribs) (Created page with 'The Directory module lets you access and manipulate directories. It separates platform dependent file system features from those features that all supported platforms have in com…') |
Bas Lijnse (talk | contribs) |
||
Line 14: | Line 14: | ||
::Path = RelativePath [PathStep] | ::Path = RelativePath [PathStep] | ||
| AbsolutePath DiskName [PathStep] | | AbsolutePath DiskName [PathStep] | ||
− | |||
// on UNIX systems the DiskName is ignored | // on UNIX systems the DiskName is ignored | ||
// on DOS/Windows/MacOS the ":" is omitted | // on DOS/Windows/MacOS the ":" is omitted | ||
− | |||
::PathStep = PathUp | ::PathStep = PathUp | ||
| PathDown String | | PathDown String | ||
::DiskName :== String | ::DiskName :== String | ||
− | |||
To reference a file named "a" in the current directory's parent direcory type RelativePath [PathUp, PathDown "a"]. The corresponding platform dependent specifications would be "..\\a" (Windows) " ../a" (Unix) or " ::a" (MacOS). To reference the file named "a" on disk "myDisk" of your Mac type AbsolutePath "myDisk" [PathDown "a"]. | To reference a file named "a" in the current directory's parent direcory type RelativePath [PathUp, PathDown "a"]. The corresponding platform dependent specifications would be "..\\a" (Windows) " ../a" (Unix) or " ::a" (MacOS). To reference the file named "a" on disk "myDisk" of your Mac type AbsolutePath "myDisk" [PathDown "a"]. | ||
Latest revision as of 11:57, 6 July 2010
The Directory module lets you access and manipulate directories. It separates platform dependent file system features from those features that all supported platforms have in common.
The following operations are supported:
- getting the contents of a directory with various information about all it's files;
- getting this information for a single file;
- creating a directory;
- moving/renaming files/directories;
- removing files/directories;
- setting and retrieving the current directory;
- getting the names of all disks.
Paths can be specified in a platform independent way. Therefore we defined the following types:
::Path = RelativePath [PathStep] | AbsolutePath DiskName [PathStep] // on UNIX systems the DiskName is ignored // on DOS/Windows/MacOS the ":" is omitted ::PathStep = PathUp | PathDown String ::DiskName :== String
To reference a file named "a" in the current directory's parent direcory type RelativePath [PathUp, PathDown "a"]. The corresponding platform dependent specifications would be "..\\a" (Windows) " ../a" (Unix) or " ::a" (MacOS). To reference the file named "a" on disk "myDisk" of your Mac type AbsolutePath "myDisk" [PathDown "a"].
The specifications in the definition module should be self explanatory.
Hints: Specifying absolute paths inherently leads into platform dependent programs.To check whether a given file exists use the "getFileInfo" function.