Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Osfiles Source Code
 previous   up   next 

Types
osFileSys
FileSys implementation type to access operating system files.

osFileSys

const type: osFileSys

FileSys implementation type to access operating system files.


Variable Summary
fileSys
osFiles
File system of the operating system files.

Function Summary
array string
readDir (in string: dirPath)
Determine the filenames in a directory.
fileType
fileType (in string: filePath)
Determine the type of a file.
fileType
fileTypeSL (in string: filePath)
Determine the type of a file.
fileMode
fileMode (in string: filePath)
Determine the file mode (permissions) of a file.
void
setFileMode (in string: filePath, in fileMode: mode)
Change the file mode (permissions) of a file.
integer
fileSize (in string: filePath)
Determine the size of a file.
bigInteger
bigFileSize (in string: filePath)
Determine the size of a file.
time
getATime (in string: filePath)
Determine the access time of a file.
time
getCTime (in string: filePath)
Determine the change time of a file.
time
getMTime (in string: filePath)
Determine the modification time of a file.
void
setATime (in string: filePath, in time: aTime)
Set the access time of a file.
void
setMTime (in string: filePath, in time: aTime)
Set the modification time of a file.
string
readlink (in string: filePath)
Reads the destination of a symbolic link.
void
symlink (in string: sourcePath, in string: destPath)
Create a symbolic link.
void
removeFile (in string: filePath)
Remove a file of any type unless it is a directory that is not empty.
void
removeTree (in string: filePath)
Remove a file of any type inclusive a directory tree.
void
copyFile (in string: sourcePath, in string: destPath)
Copy a file or directory tree.
void
cloneFile (in string: sourcePath, in string: destPath)
Clone a file or directory tree.
void
moveFile (in string: sourcePath, in string: destPath)
Move and rename a file or directory tree.
void
mkdir (in string: dirPath)
Creates a new directory.
string
getcwd
Determine the current working directory of the calling process.
void
chdir (in string: dirPath)
Changes the current working directory of the calling process.
string
homeDir
Determine the home directory of the user.
string
toAbsPath (in string: basePath, in string: path)
Determine the absolute path for a given path.

Variable Detail

osFiles

var fileSys: osFiles

File system of the operating system files.


Function Detail

readDir

const func array string: readDir (in string: dirPath)

Determine the filenames in a directory. The files "." and ".." are left out from the result. Note that the function returns only the filenames. Additional information must be obtained with 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 - 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. When the chain of symbolic links is too long the function returns FILE_SYMLINK. When 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 illegal 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 or ENAMETOOLONG.

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 illegal 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 or ENAMETOOLONG.

fileMode

const func fileMode: fileMode (in string: filePath)

Determine the file mode (permissions) of a file.

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 - A system function returns an error.

setFileMode

const proc: setFileMode (in string: filePath, in fileMode: mode)

Change the file mode (permissions) of a 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 - A system function returns an error.

fileSize

const func integer: fileSize (in string: filePath)

Determine the 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.
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 file size is measured in bytes. For directories 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.

getATime

const func time: getATime (in string: filePath)

Determine the access time of a file.

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 - A system function returns an error.

getCTime

const func time: getCTime (in string: filePath)

Determine the change time of a file.

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 - A system function returns an error.

getMTime

const func time: getMTime (in string: filePath)

Determine the modification time of a file.

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 - A system function returns an error.

setATime

const proc: setATime (in string: filePath, in time: aTime)

Set the access time of a 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 - aTime is invalid or cannot be converted to the system file time.
FILE_ERROR - A system function returns an error.

setMTime

const proc: setMTime (in string: filePath, in time: aTime)

Set the modification time of a 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 - aTime is invalid or cannot be converted to the system file time.
FILE_ERROR - A system function returns an error.

readlink

const func string: readlink (in string: filePath)

Reads the destination of a symbolic link.

Returns:
The destination refered 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 the path does not exist or is not a symbolic link.

symlink

const proc: symlink (in string: sourcePath, in string: destPath)

Create a symbolic link. The symbolic link destPath will refer to sourcePath afterwards.

Parameters:
sourcePath - String to be contained in the symbolic link.
destPath - Name of the symbolic link to be created.
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 - 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. An attempt to remove a directory that is not empty triggers FILE_ERROR.

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. When 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. When cloneFile succeeds the original file is deleted. When 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.

mkdir

const proc: mkdir (in string: dirPath)

Creates a new directory.

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.

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.

toAbsolute(getcwd, "aFile")    -->  Returns e.g. "/home/myuser/aFile"
toAbsolute(".", "aFile")       -->  Returns e.g. "/home/myuser/aFile"
toAbsolute("/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.


 previous   up   next