Libraries |
|
File system | Source Code |
|
|
Types | ||||
| ||||
| ||||
| ||||
| ||||
|
fileType
const type: fileType
-
Type to describe the type of a file. Possible values are FILE_ABSENT, FILE_UNKNOWN, FILE_REGULAR, FILE_DIR, FILE_CHAR, FILE_BLOCK, FILE_FIFO, FILE_SYMLINK and FILE_SOCKET. The value FILE_ABSENT is used to describe a nonexistent file.
filePermission
const type: filePermission
-
Type to describe one file permission. Possible values are EXEC_OTHER, WRITE_OTHER, READ_OTHER, EXEC_GROUP, WRITE_GROUP, READ_GROUP, EXEC_USER and WRITE_USER and READ_USER.
fileMode
const type: fileMode
-
Type to describe the mode (all permissions) of a file. A fileMode is a set of filePermission. A test for a permission is a set mempership test. E.g.:
EXEC_USER in aFileMode
fileSys
const type: fileSys
Operator Summary | |||||
fileSys |
|
Function Summary | |||||
string |
| ||||
string |
| ||||
void |
| ||||
array string |
| ||||
array string |
| ||||
array string |
| ||||
array string |
| ||||
fileType |
| ||||
fileType |
| ||||
integer |
| ||||
bigInteger |
| ||||
fileMode |
| ||||
void |
| ||||
time |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
fileMode |
| ||||
time |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
file |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
array string |
| ||||
bigInteger |
|
Operator Detail |
Function Detail |
removeDotFiles
const func string: removeDotFiles (in string: path)
-
Removes dot files (. and ..) from a path.
removeDotFiles("/home/myuser/aFile/..") returns "/home/myuser" removeDotFiles("/aDir/aFile/../../home/myuser") returns "/home/myuser" removeDotFiles("/aDir/aFile/../../..") returns "/" removeDotFiles("aDir/aFile/../../..") returns ".." removeDotFiles("aDir/./aFile/.") returns "aDir/aFile"
- Parameters:
- path - Absolute or relative path where the dot files should be removed.
- Returns:
- an absolute or relative path without dot files.
symlinkDestination
const func string: symlinkDestination (in string: symlinkPath, in string: targetPath)
-
Destination of the symlink symlinkPath with the target targetPath. Symbolic links can be relative or absolute. Relative symbolic links are relative to their place in the file system and not relative to the current working directory.
- Parameters:
- symlinkPath - Path of the symbolic link.
- targetPath - Relative or absolute target of the symbolic link:
- Returns:
- an absolute or relative destination of the symbolic link.
readDir
const func array string: readDir (inout fileSys: fileSystem, in string: dirPath)
-
Determine the filenames in a directory of a file system. Note that the function returns only the file names. Additional information must be obtained with other calls.
- Parameters:
- fileSystem - File system in which the directory is searched for.
- dirPath - Path of a directory in the file system.
- Returns:
- an array with the file names.
readDir
const func array string: readDir (inout fileSys: fileSystem, in string: dirPath, RECURSIVE)
-
Paths of files in a directory and its subdirectories inside a file system. The function returns the file paths relative to the given directory.
- Parameters:
- fileSystem - File system in which the directory is searched for.
- dirPath - Path of a directory in the file system.
- Returns:
- an array with the file paths.
readDir
const func array string: readDir (inout fileSys: fileSystem)
-
Determine the file names in the top directory of a file system.
- Returns:
- an array with the file names.
readDir
const func array string: readDir (inout fileSys: fileSystem, RECURSIVE)
-
Determine all file paths in a file system.
- Returns:
- an array with the file paths.
fileType
const func fileType: fileType (inout fileSys: fileSystem, in string: filePath)
-
Determine the type of a file. The function does follow symbolic links. Therefore it never returns FILE_SYMLINK. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.
- Returns:
- the type of the file.
fileTypeSL
const func fileType: fileTypeSL (inout fileSys: fileSystem, in string: filePath)
-
Determine the type of a file. The function does not follow symbolic links. Therefore it may return FILE_SYMLINK. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.
- Returns:
- the type of the file.
fileSize
const func integer: fileSize (inout fileSys: fileSystem, in string: filePath)
-
Determine the file size of a file. The function follows symbolic links. The file size is measured in bytes. For directories a size of 0 is returned.
- Returns:
- the size of the file.
bigFileSize
const func bigInteger: bigFileSize (inout fileSys: fileSystem, in string: filePath)
-
Determine the file size of a file. The function follows symbolic links. The file size is measured in bytes. For directories a size of 0 is returned.
- Returns:
- the size of the file.
getFileMode
const func fileMode: getFileMode (inout fileSys: fileSystem, in string: filePath)
-
Determine the file mode (permissions) of a file. The function follows symbolic links.
- Returns:
- the file mode.
setFileMode
const proc: setFileMode (inout fileSys: fileSystem, in string: filePath, in fileMode: mode)
-
Change the file mode (permissions) of a file. The function follows symbolic links. Not all file systems support this function.
getMTime
const func time: getMTime (inout fileSys: fileSystem, in string: filePath)
-
Determine the modification time of a file. The function follows symbolic links.
- Returns:
- the modification time of the file.
setMTime
const proc: setMTime (inout fileSys: fileSystem, in string: filePath, in time: modificationTime)
-
Set the modification time of a file. The function follows symbolic links.
getOwner
const func string: getOwner (inout fileSys: fileSystem, in string: filePath)
-
Determine the name of the owner (UID) of a file. The function follows symbolic links.
- Returns:
- the name of the file owner.
setOwner
const proc: setOwner (inout fileSys: fileSystem, in string: filePath, in string: owner)
-
Set the owner of a file. The function follows symbolic links.
getGroup
const func string: getGroup (inout fileSys: fileSystem, in string: filePath)
-
Determine the name of the group (GID) to which a file belongs. The function follows symbolic links.
- Returns:
- the name of the file group.
setGroup
const proc: setGroup (inout fileSys: fileSystem, in string: filePath, in string: group)
-
Set the group of a file. The function follows symbolic links.
getFileMode
const func fileMode: getFileMode (inout fileSys: fileSystem, in string: filePath, SYMLINK)
-
Determine the file mode (permissions) of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the file mode.
getMTime
const func time: getMTime (inout fileSys: fileSystem, in string: filePath, SYMLINK)
-
Determine the modification time of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the modification time of the symbolic link.
setMTime
const proc: setMTime (inout fileSys: fileSystem, in string: filePath, in time: modificationTime, SYMLINK)
-
Set the modification time of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
getOwner
const func string: getOwner (inout fileSys: fileSystem, in string: filePath, SYMLINK)
-
Determine the name of the owner (UID) of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the name of the file owner.
setOwner
const proc: setOwner (inout fileSys: fileSystem, in string: filePath, in string: owner, SYMLINK)
-
Set the owner of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
getGroup
const func string: getGroup (inout fileSys: fileSystem, in string: filePath, SYMLINK)
-
Determine the name of the group (GID) to which a symbolic link belongs. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the name of the file group.
setGroup
const proc: setGroup (inout fileSys: fileSystem, in string: filePath, in string: group, SYMLINK)
-
Set the group of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
open
const func file: open (inout fileSys: fileSystem, in string: filePath, in string: mode)
-
Open a file with filePath and mode in the file system.
getFile
const func string: getFile (inout fileSys: fileSystem, in string: filePath)
-
Get the contents of file filePath in the file system.
- Returns:
- the specified file as string.
putFile
const proc: putFile (inout fileSys: fileSystem, in string: filePath, in string: stri)
-
Write stri to the file filePath using the file system. If the file exists already, it is overwritten. Not all file systems support this function.
readLink
const func string: readLink (inout fileSys: fileSystem, in string: filePath)
-
Reads the destination of a symbolic link. Not all file systems support this function.
- Returns:
- The destination referred by the symbolic link.
makeLink
const proc: makeLink (inout fileSys: fileSystem, in string: symlinkPath, in string: targetPath)
-
Create a symbolic link. The symbolic link symlinkPath will refer to targetPath afterwards. The function does not follow symbolic links. Not all file systems support this function.
- Parameters:
- fileSystem - Open file system.
- symlinkPath - Name of the symbolic link to be created.
- targetPath - String to be contained in the symbolic link.
removeFile
const proc: removeFile (inout fileSys: fileSystem, in string: filePath)
-
Remove a file (except a nonempty directory), from a file system. The function does not follow symbolic links. Not all file systems support this function.
- Parameters:
- fileSystem - Open file system.
- filePath - Name of the file to be removed.
removeTree
const proc: removeTree (inout fileSys: fileSystem, in string: filePath)
-
Remove a file of any type inclusive a directory tree, from a file system. Not all file systems support this function.
moveFile
const proc: moveFile (inout fileSys: fileSystem, in string: sourcePath, in string: destPath)
-
Move and rename a file or directory tree in a file system. Not all file systems support this function.
makeDir
const proc: makeDir (inout fileSys: fileSystem, in string: dirPath)
-
Create a directory in the file system. The function does not follow symbolic links. Not all file systems support this function.
- Parameters:
- fileSystem - Open file system.
- dirPath - Name of the directory to be created.
rmdir
const proc: rmdir (inout fileSys: fileSystem, in string: dirPath)
-
Deletes an empty directory in the file system. Not all file systems support this function.
getcwd
const func string: getcwd (inout fileSys: fileSystem)
-
Determine the current working directory of the file system. Not all file systems support this function.
- Returns:
- the current working directory as absolute path.
chdir
const proc: chdir (inout fileSys: fileSystem, in string: dirPath)
-
Change the current working directory of the file system. Not all file systems support this function.
readDir
const func array string: readDir (inout emptyFileSys: fileSystem, in var string: dirPath, RECURSIVE)
-
Paths of files in a directory and its subdirectories inside a file system. The function returns the file paths relative to the given directory.
- Parameters:
- fileSystem - File system in which the directory is searched for.
- dirPath - Path of a directory in the file system.
- Returns:
- an array with the file paths.
- Raises:
- RANGE_ERROR - dirPath does not use the standard path representation.
- FILE_ERROR - dirPath is not present in the file system.
bigFileSize
const func bigInteger: bigFileSize (inout emptyFileSys: fileSystem, in string: filePath)
-
Determine the file size of a file. The file size is measured in bytes. For directories a size of 0 is returned.
- Returns:
- the size of the file.
|
|