Libraries |
|
Osfiles | Source Code |
|
|
Variable Summary | |||||
fileSys |
|
Function Summary | |||||
array string |
| ||||
fileType |
| ||||
fileType |
| ||||
integer |
| ||||
bigInteger |
| ||||
fileMode |
| ||||
void |
| ||||
time |
| ||||
void |
| ||||
time |
| ||||
time |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
fileMode |
| ||||
time |
| ||||
time |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
string |
|
Function Detail |
readDir
const func array string: readDir (in string: dirPath)
-
Determine the filenames in a directory. The function does follow symbolic links. The files "." and ".." are excluded from the result. Note that the function returns only the filenames. Additional information must be obtained using other calls.
- Returns:
- a string-array containing the filenames in the directory.
- Raises:
- MEMORY_ERROR - Not enough memory to convert dirPath to the system path type or not enough memory to represent the result string array.
- RANGE_ERROR - dirPath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with dirPath does not exist, or it is not a directory, or a system function returns an error.
fileType
const func fileType: fileType (in string: filePath)
-
Determine the type of a file. The function does follow symbolic links. If the chain of symbolic links is too long the function returns FILE_SYMLINK. If a symbolic link refers to a place where the permission is denied the function 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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The system function returns an error other than ENOENT, ENOTDIR, ENAMETOOLONG or EACCES.
fileTypeSL
const func fileType: fileTypeSL (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The system function returns an error other than ENOENT, ENOTDIR, ENAMETOOLONG or EACCES.
fileSize
const func integer: fileSize (in string: filePath)
-
Determine the size of a file. The function follows symbolic links. The file size is measured in bytes. For directories, fifos and sockets a size of 0 is returned.
- Returns:
- the size of the file.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- RANGE_ERROR - The file size is not representable as integer.
- FILE_ERROR - It was not possible to determine the file size.
bigFileSize
const func bigInteger: bigFileSize (in string: filePath)
-
Determine the size of a file. The function follows symbolic links. The file size is measured in bytes. For directories, fifos and sockets a size of 0 is returned.
- Returns:
- the size of the file.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - It was not possible to determine the file size.
getFileMode
const func fileMode: getFileMode (in string: filePath)
-
Determine the file mode (permissions) of a file. The function follows symbolic links.
- Returns:
- the file mode.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
setFileMode
const proc: setFileMode (in string: filePath, in fileMode: mode)
-
Change the file mode (permissions) of a file. The function follows symbolic links.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
getATime
const func time: getATime (in string: filePath)
-
Determine the access time of a file. The function follows symbolic links.
- Returns:
- the access time of the file.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
setATime
const proc: setATime (in string: filePath, in time: aTime)
-
Set the access time of a file. The function follows symbolic links.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- RANGE_ERROR - aTime is invalid or it cannot be converted to the system file time.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
getCTime
const func time: getCTime (in string: filePath)
-
Determine the change time of a file. The function follows symbolic links.
- Returns:
- the change time of the file.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
getMTime
const func time: getMTime (in string: filePath)
-
Determine the modification time of a file. The function follows symbolic links.
- Returns:
- the modification time of the file.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
setMTime
const proc: setMTime (in string: filePath, in time: mTime)
-
Set the modification time of a file. The function follows symbolic links.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- RANGE_ERROR - mTime is invalid or it cannot be converted to the system file time.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
getOwner
const func string: getOwner (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
setOwner
const proc: setOwner (in string: filePath, in string: owner)
-
Set the owner of a file. The function follows symbolic links.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
getGroup
const func string: getGroup (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
setGroup
const proc: setGroup (in string: filePath, in string: group)
-
Set the group of a file. The function follows symbolic links.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or a system function returns an error.
getFileMode
const func fileMode: getFileMode (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
getATime
const func time: getATime (in string: filePath, SYMLINK)
-
Determine the access time of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the access time of the symbolic link.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
getMTime
const func time: getMTime (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
setMTime
const proc: setMTime (in string: filePath, in time: mTime, SYMLINK)
-
Set the modification time of a symbolic link. The function only works for symbolic links and does not follow the symbolic link.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- RANGE_ERROR - mTime is invalid or it cannot be converted to the system file time.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
getOwner
const func string: getOwner (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.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
setOwner
const proc: setOwner (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
getGroup
const func string: getGroup (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.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
setGroup
const proc: setGroup (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.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
readLink
const func string: readLink (in string: filePath)
-
Reads the destination of a symbolic link. This function reads the link destination stored in the file system. Symbolic links can be relative or absolute. Relative symbolic links are relative to their location in the file system and not relative to the current working directory.
readLink("/aDir/symbolicLink") returns e.g. "../linkDest" readLink("/aDir/symbolicLink", ABSOLUTE) returns e.g. "/aDir/linkDest"
- Parameters:
- filePath - Relative or absolute path of a symbolic link.
- Returns:
- The destination referred by the symbolic link.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type or not enough memory to represent the result string.
- RANGE_ERROR - filePath does not use the standard path representation, or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
readLink
const func string: readLink (in string: filePath, ABSOLUTE)
-
Reads the absolute destination path of a symbolic link. The symbolic links stored in the file system can be relative or absolute. Relative symbolic links are relative to their location in the file system and not relative to the current working directory. For a relative symbolic link filePath is converted to an absolute path, and the symbolic link is concatenated to this path.
readLink("/aDir/symbolicLink") returns e.g. "../linkDest" readLink("/aDir/symbolicLink", ABSOLUTE) returns e.g. "/aDir/linkDest"
- Parameters:
- filePath - Relative or absolute path of a symbolic link.
- Returns:
- The absolute destination path referred by the symbolic link.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type or not enough memory to represent the result string.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist, or it is not a symbolic link, or a system function returns an error.
finalPath
const func string: finalPath (in string: filePath)
-
Get the final path that functions like getMTime() and open() would use. If filePath is not a symbolic link it is returned. For a symbolic link the function follows the symbolic link chain until the path is not a symbolic link again. The final path may refer to a non-existing file.
- Parameters:
- filePath - Relative or absolute path.
- Returns:
- The final path after possibly following a symbolic link chain.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type or not enough memory to represent the result string.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file described with filePath does not exist or a system function returns an error.
makeLink
const proc: makeLink (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.
- Parameters:
- symlinkPath - Name of the symbolic link to be created.
- targetPath - String to be contained in the symbolic link.
- Raises:
- MEMORY_ERROR - Not enough memory to convert symlinkPath or targetPath to the system path type.
- RANGE_ERROR - symlinkPath or targetPath does not use the standard path representation or one of them cannot be converted to the system path type.
- FILE_ERROR - The file symlinkPath already exists, or a system function returns an error.
removeFile
const proc: removeFile (in string: filePath)
-
Remove a file of any type unless it is a directory that is not empty. The function does not follow symbolic links. An attempt to remove a directory that is not empty triggers FILE_ERROR.
- Parameters:
- filePath - Name of the file to be removed.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file does not exist or it is a directory that is not empty or a system function returns an error.
removeTree
const proc: removeTree (in string: filePath)
-
Remove a file of any type inclusive a directory tree.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file does not exist or a system function returns an error.
copyFile
const proc: copyFile (in string: sourcePath, in string: destPath)
-
Copy a file or directory tree. Permissions/mode, ownership and timestamps of the destination file are determined independent of the corresponding source properties. The destination file gets the permissions/mode defined by umask. The user executing the program is the owner of the destination file. The timestamps of the destination file are set to the current time. Symbolic links in sourcePath are always followed. Therefore copyFile will never create a symbolic link. Note that copyFile does not preserve hard links (they are resolved to distinct files).
- Raises:
- MEMORY_ERROR - Not enough memory to convert sourcePath or destPath to the system path type.
- RANGE_ERROR - sourcePath or destPath does not use the standard path representation or one of them cannot be converted to the system path type.
- FILE_ERROR - Source file does not exist, destination file already exists or a system function returns an error.
cloneFile
const proc: cloneFile (in string: sourcePath, in string: destPath)
-
Clone a file or directory tree. Permissions/mode, ownership and timestamps of the original are preserved. Symlinks are not followed. Instead the symlink is copied. Note that cloneFile does not preserve hard links (they are resolved to distinct files).
- Raises:
- MEMORY_ERROR - Not enough memory to convert sourcePath or destPath to the system path type.
- RANGE_ERROR - sourcePath or destPath does not use the standard path representation or one of them cannot be converted to the system path type.
- FILE_ERROR - Source file does not exist, destination file already exists or a system function returns an error.
moveFile
const proc: moveFile (in string: sourcePath, in string: destPath)
-
Move and rename a file or directory tree. The function uses the C rename() function. If rename() fails the file (or directory tree) is cloned with cloneFile (which preserves permissions/mode, ownership and timestamps) to the new place and with the new name. If cloneFile succeeds the original file is deleted. If cloneFile fails (no space on device or other reason) all remains of the failed clone are removed. Note that cloneFile works for symbolic links but does not preserve hard links (they are resolved to distinct files).
- Raises:
- MEMORY_ERROR - Not enough memory to convert sourcePath or destPath to the system path type.
- RANGE_ERROR - sourcePath or destPath does not use the standard path representation or one of them cannot be converted to the system path type.
- FILE_ERROR - Source file does not exist, destination file already exists or a system function returns an error.
makeDir
const proc: makeDir (in string: dirPath)
-
Create a new directory. The function does not follow symbolic links.
- Parameters:
- dirPath - Name of the directory to be created.
- Raises:
- MEMORY_ERROR - Not enough memory to convert dirPath to the system path type.
- RANGE_ERROR - dirPath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - The file dirPath already exists, or a system function returns an error.
getcwd
const func string: getcwd
-
Determine the current working directory of the calling process.
- Returns:
- The absolute path of the current working directory.
- Raises:
- MEMORY_ERROR - Not enough memory to represent the result string.
- FILE_ERROR - The system function returns an error.
chdir
const proc: chdir (in string: dirPath)
-
Changes the current working directory of the calling process.
- Raises:
- MEMORY_ERROR - Not enough memory to convert dirPath to the system path type.
- RANGE_ERROR - dirPath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - A system function returns an error.
homeDir
const func string: homeDir
-
Determine the home directory of the user. This function should be preferred over the use of an environment variable such as $HOME. $HOME is not supported under all operating systems and it is not guaranteed, that it uses the standard path representation.
- Returns:
- The absolute path of the home directory.
- Raises:
- MEMORY_ERROR - Not enough memory to represent the result string.
- FILE_ERROR - Not able to determine the home directory.
toAbsPath
const func string: toAbsPath (in string: basePath, in string: path)
-
Determine the absolute path for a given path. The examples assume that the current working directory is "/home/myuser".
toAbsPath(getcwd, "aFile") returns e.g. "/home/myuser/aFile" toAbsPath(".", "aFile") returns e.g. "/home/myuser/aFile" toAbsPath(".", "../aFile") returns e.g. "/home/aFile" toAbsPath(".", "..") returns e.g. "/home" toAbsPath("/usr", "include") returns "/usr/include"
- Parameters:
- basePath - Path of the base location. The relative path is relative to this location.
- path - Absolute or relative path for which the absolute path should be determined:
- Returns:
- path if path is already absolute, or concatenate basePath with path.
makeParentDirs
const proc: makeParentDirs (in string: filePath)
-
Create the parent directories of the given filePath.
- Raises:
- MEMORY_ERROR - Not enough memory to convert filePath to the system path type.
- RANGE_ERROR - filePath does not use the standard path representation or it cannot be converted to the system path type.
- FILE_ERROR - A system function returns an error, or a component of filePath is not a directory.
convDosPath
const func string: convDosPath (in string: path)
-
Convert a DOS/Windows path to the standard path representation. A path in the standard path representation is left unchanged.
convDosPath("C:/abc") returns "/c/abc" convDosPath("C:/abc/") returns "/c/abc" convDosPath("C:/abc//def") returns "/c/abc/def" convDosPath("C:\\abc") returns "/c/abc" convDosPath("C:\\abc\\") returns "/c/abc" convDosPath("C:\\abc\\\\def") returns "/c/abc/def" convDosPath("d:/abc") returns "/d/abc" convDosPath("d://abc") returns "/d/abc" convDosPath("d:\\abc") returns "/d/abc" convDosPath("d:\\\\abc") returns "/d/abc" convDosPath("d:abc") returns "/d/abc" convDosPath("dir/file") returns "dir/file" convDosPath("dir\\file") returns "dir/file" convDosPath("/usr/include") returns "/usr/include"
- Parameters:
- path - Absolute or relative DOS/Windows path.
- Returns:
- The path in the standard path representation.
|
|