Libraries
Tar Source Code
 previous   up   next 

Types
tarArchive
FileSys implementation type to access a TAR archive.

tarArchive

const type: tarArchive

FileSys implementation type to access a TAR archive. File paths in a TAR archive can be absolute (they start with a slash) or relative (they do not start with a slash). The tar file system does not support the concept of a current working directory. The functions chdir and getcwd are not supported by the tar file system. Absolute and relative paths in a TAR archive can be accessed directly. Since "/" is just a normal path in a TAR archive the root path of a tar file system is "". Possible usages of tar file system functions are:

 getMTime(aTarArchive, "src/drivers")   # Relative path in the archive.
 fileType(aTarArchive, "/usr/include")  # Absolute path in the archive.
 fileSize(aTarArchive, "/image")        # Absolute path in the archive.
 readDir(aTarArchive, "")               # Return e.g.: "src" and "/"
 readDir(aTarArchive, "/")              # Return e.g.: "usr" and "image"

Function Summary
fileSys
openTar (inout file: tarFile)
Open a TAR archive with the given tarFile.
fileSys
openTar (in string: tarFileName)
Open a TAR archive with the given tarFileName.
void
close (inout tarArchive: tar)
Close a TAR archive. The TAR file below stays open.
array string
readDir (inout tarArchive: tar, in string: dirPath)
Determine the file names in a directory inside a TAR archive.
array string
readDir (inout tarArchive: tar, RECURSIVE)
Determine the file paths in a TAR archive.
fileType
fileType (inout tarArchive: tar, in var string: filePath)
Determine the type of a file in a TAR archive.
fileType
fileTypeSL (inout tarArchive: tar, in string: filePath)
Determine the type of a file in a TAR archive.
fileMode
getFileMode (inout tarArchive: tar, in string: filePath)
Determine the file mode (permissions) of a file in a TAR archive.
void
setFileMode (inout tarArchive: tar, in string: filePath, in fileMode: mode)
Change the file mode (permissions) of a file in a TAR archive.
integer
fileSize (inout tarArchive: tar, in string: filePath)
Determine the size of a file in a TAR archive.
time
getMTime (inout tarArchive: tar, in string: filePath)
Determine the modification time of a file in a TAR archive.
void
setMTime (inout tarArchive: tar, in string: filePath, in time: modificationTime)
Set the modification time of a file in a TAR archive.
string
getOwner (inout tarArchive: tar, in string: filePath)
Determine the name of the owner (UID) of a file in a TAR archive.
void
setOwner (inout tarArchive: tar, in string: filePath, in string: owner)
Set the owner of a file in a TAR archive.
string
getGroup (inout tarArchive: tar, in string: filePath)
Determine the name of the group (GID) of a file in a TAR archive.
void
setGroup (inout tarArchive: tar, in string: filePath, in string: group)
Set the group of a file in a TAR archive.
fileMode
getFileMode (inout tarArchive: tar, in string: filePath, SYMLINK)
Determine the file mode (permissions) of a symbolic link in a TAR archive.
time
getMTime (inout tarArchive: tar, in string: filePath, SYMLINK)
Determine the modification time of a symbolic link in a TAR archive.
void
setMTime (inout tarArchive: tar, in string: filePath, in time: modificationTime, SYMLINK)
Set the modification time of a symbolic link in a TAR archive.
string
getOwner (inout tarArchive: tar, in string: filePath, SYMLINK)
Determine the name of the owner (UID) of a symbolic link in a TAR archive.
void
setOwner (inout tarArchive: tar, in string: filePath, in string: owner, SYMLINK)
Set the owner of a symbolic link in a TAR archive.
string
getGroup (inout tarArchive: tar, in string: filePath, SYMLINK)
Determine the name of the group (GID) of a symbolic link in a TAR archive.
void
setGroup (inout tarArchive: tar, in string: filePath, in string: group, SYMLINK)
Set the group of a symbolic link in a TAR archive.
string
readLink (inout tarArchive: tar, in string: filePath)
Reads the destination of a symbolic link in a TAR archive.
void
makeLink (inout tarArchive: tar, in string: symlinkPath, in string: targetPath)
Create a symbolic link in a TAR archive.
string
getFile (inout tarArchive: tar, in string: filePath)
Get the contents of a file in a TAR archive.
void
putFile (inout tarArchive: tar, in var string: filePath, in string: data)
Write data to a TAR archive with the given filePath.
void
makeDir (inout tarArchive: tar, in string: dirPath)
Create a new directory in a TAR archive.
void
removeFile (inout tarArchive: tar, in string: filePath)
Remove any file except non-empty directories from a TAR archive.
void
for (inout string: filePath) range (inout tarArchive: tar) do (in proc: statements) end for
For-loop which loops recursively over the paths in a TAR archive.
file
open (inout tarArchive: tar, in string: filePath, in string: mode)
Open a file with filePath and mode in in a TAR archive.

Function Detail

openTar

const func fileSys: openTar (inout file: tarFile)

Open a TAR archive with the given tarFile.

Parameters:
tarFile - File that contains a TAR archive.
Returns:
a file system that accesses the TAR archive, or fileSys.value if it could not be opened.

openTar

const func fileSys: openTar (in string: tarFileName)

Open a TAR archive with the given tarFileName.

Parameters:
tarFileName - Name of the TAR archive to be opened.
Returns:
a file system that accesses the TAR archive, or fileSys.value if it could not be opened.

close

const proc: close (inout tarArchive: tar)

Close a TAR archive. The TAR file below stays open.


readDir

const func array string: readDir (inout tarArchive: tar, in string: dirPath)

Determine the file names in a directory inside a TAR archive. Note that the function returns only the file names. Additional information must be obtained with other calls.

Parameters:
tar - Open TAR archive.
dirPath - Path of a directory in the TAR archive.
Returns:
an array with the file names.
Raises:
RANGE_ERROR - dirPath does not use the standard path representation.
FILE_ERROR - dirPath is not present in the TAR archive.

readDir

const func array string: readDir (inout tarArchive: tar, RECURSIVE)

Determine the file paths in a TAR archive. Note that the function returns only the file paths. Additional information must be obtained with other calls.

Parameters:
tar - Open TAR archive.
Returns:
an array with the file paths.

fileType

const func fileType: fileType (inout tarArchive: tar, in var string: filePath)

Determine the type of a file in a TAR archive. The function follows symbolic links. If the chain of symbolic links is too long 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:
RANGE_ERROR - filePath does not use the standard path representation.

fileTypeSL

const func fileType: fileTypeSL (inout tarArchive: tar, in string: filePath)

Determine the type of a file in a TAR archive. 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:
RANGE_ERROR - filePath does not use the standard path representation.

getFileMode

const func fileMode: getFileMode (inout tarArchive: tar, in string: filePath)

Determine the file mode (permissions) of a file in a TAR archive. The function follows symbolic links.

Returns:
the file mode.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

setFileMode

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

Change the file mode (permissions) of a file in a TAR archive. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

fileSize

const func integer: fileSize (inout tarArchive: tar, in string: filePath)

Determine the size of a file in a TAR archive. The file size is measured in bytes. For directories a size of 0 is returned. The function follows symbolic links.

Returns:
the size of the file.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

getMTime

const func time: getMTime (inout tarArchive: tar, in string: filePath)

Determine the modification time of a file in a TAR archive. The function follows symbolic links.

Returns:
the modification time of the file.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

setMTime

const proc: setMTime (inout tarArchive: tar, in string: filePath, in time: modificationTime)

Set the modification time of a file in a TAR archive. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
RANGE_ERROR - modificationTime is invalid or cannot be converted to the system file time.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

getOwner

const func string: getOwner (inout tarArchive: tar, in string: filePath)

Determine the name of the owner (UID) of a file in a TAR archive. The function follows symbolic links.

Returns:
the name of the file owner.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

setOwner

const proc: setOwner (inout tarArchive: tar, in string: filePath, in string: owner)

Set the owner of a file in a TAR archive. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

getGroup

const func string: getGroup (inout tarArchive: tar, in string: filePath)

Determine the name of the group (GID) of a file in a TAR archive. The function follows symbolic links.

Returns:
the name of the file group.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

setGroup

const proc: setGroup (inout tarArchive: tar, in string: filePath, in string: group)

Set the group of a file in a TAR archive. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or the chain of symbolic links is too long.

getFileMode

const func fileMode: getFileMode (inout tarArchive: tar, in string: filePath, SYMLINK)

Determine the file mode (permissions) of a symbolic link in a TAR archive. The function only works for symbolic links and does not follow the symbolic link.

Returns:
the file mode.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

getMTime

const func time: getMTime (inout tarArchive: tar, in string: filePath, SYMLINK)

Determine the modification time of a symbolic link in a TAR archive. The function only works for symbolic links and does not follow the symbolic link.

Returns:
the modification time of the symbolic link.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

setMTime

const proc: setMTime (inout tarArchive: tar, in string: filePath, in time: modificationTime, SYMLINK)

Set the modification time of a symbolic link in a TAR archive. The function only works for symbolic links and does not follow the symbolic link.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
RANGE_ERROR - modificationTime is invalid or it cannot be converted to the system file time.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

getOwner

const func string: getOwner (inout tarArchive: tar, in string: filePath, SYMLINK)

Determine the name of the owner (UID) of a symbolic link in a TAR archive. 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.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

setOwner

const proc: setOwner (inout tarArchive: tar, in string: filePath, in string: owner, SYMLINK)

Set the owner of a symbolic link in a TAR archive. The function only works for symbolic links and does not follow the symbolic link.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

getGroup

const func string: getGroup (inout tarArchive: tar, in string: filePath, SYMLINK)

Determine the name of the group (GID) of a symbolic link in a TAR archive. 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.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

setGroup

const proc: setGroup (inout tarArchive: tar, in string: filePath, in string: group, SYMLINK)

Set the group of a symbolic link in a TAR archive. The function only works for symbolic links and does not follow the symbolic link.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the TAR archive, or it is not a symbolic link.

readLink

const func string: readLink (inout tarArchive: tar, in string: filePath)

Reads the destination of a symbolic link in a TAR archive.

Returns:
The destination referred by the symbolic link.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or is not a symbolic link.

makeLink

const proc: makeLink (inout tarArchive: tar, in string: symlinkPath, in string: targetPath)

Create a symbolic link in a TAR archive. The symbolic link symlinkPath will refer to targetPath afterwards. The function does not follow symbolic links.

Parameters:
tar - Open TAR archive.
symlinkPath - Name of the symbolic link to be created.
targetPath - String to be contained in the symbolic link.
Raises:
RANGE_ERROR - targetPath or symlinkPath does not use the standard path representation.
FILE_ERROR - A system function returns an error.

getFile

const func string: getFile (inout tarArchive: tar, in string: filePath)

Get the contents of a file in a TAR archive. The function follows symbolic links.

Returns:
the specified file as string.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the TAR archive, or is not a regular file, or the chain of symbolic links is too long.

putFile

const proc: putFile (inout tarArchive: tar, in var string: filePath, in string: data)

Write data to a TAR archive with the given filePath. If the file exists already, it is overwritten. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file exists, but it is not a regular file.

makeDir

const proc: makeDir (inout tarArchive: tar, in string: dirPath)

Create a new directory in a TAR archive. The function does not follow symbolic links.

Parameters:
tar - Open TAR archive.
dirPath - Name of the directory to be created.
Raises:
RANGE_ERROR - dirPath does not use the standard path representation.
FILE_ERROR - The file dirPath already exists.

removeFile

const proc: removeFile (inout tarArchive: tar, in string: filePath)

Remove any file except non-empty directories from a TAR archive. The function does not follow symbolic links. An attempt to remove a directory that is not empty triggers FILE_ERROR.

Parameters:
tar - Open TAR archive.
filePath - Name of the file to be removed.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file does not exist or it is a directory that is not empty.

for

const proc: for (inout string: filePath) range (inout tarArchive: tar) do (in proc: statements) end for

For-loop which loops recursively over the paths in a TAR archive.


open

const func file: open (inout tarArchive: tar, in string: filePath, in string: mode)

Open a file with filePath and mode in in a TAR archive.



 previous   up   next