Index | | | Related pages | | | Classes | | | Functions | | | Entities | | | Function Sets | | | Groups |
Directory and file names functions. more...
FileReadStats | |
dirChange | Changes the current working directory. |
dirCurrent | Returns the current working directory. |
dirMake | Creates a directory. |
dirMakeLink | Creates a soft link to a file. |
dirReadLink | On systems supporting symbolic links, returns the linked file. |
dirRemove | Removes an empty directory. |
fileChgroup | Changes UNIX group to a directory entry. |
fileChmod | Changes UNIX access right to a directory entry. |
fileChown | Changes UNIX owner to a directory entry. |
fileMove | Renames a file locally. |
fileRemove | Removes a file from the system. |
fileType | Deterimnes the type of a file. |
Directory functions are currently under development. The general principle is that they should be, where possible, multiplatform and portable, with some extensions working only on specific OSes. Also, the general idea on failure is that they should raise an error when success is expected, and return an error value when failure is likely. However, the behavior of the function listed in this section is subject to sudden change, as the contribution of the community (even if just in form of suggestion) is vital.
FileReadStats( filename ) | |
filename | Relative or absolute path to a file for which stats must be read |
Returns: | A new FileStat instance or nil. |
On success, retunrs a new instance of the FileStat class; on failure, nil is returned.
Changes the current working directory.
dirChange( newDir ) | |||
newDir | The new working directory. | ||
Raises: |
|
On success, the working directory is changed to the specified one. The path must be indicated in Falcon conventions (forward slashes separating directories). On failure, an IoError is raised.
Returns the current working directory.
dirCurrent( ) | |||
Returns: | A string representing the current working directory. | ||
Raises: |
|
On success, a string containing the current working directory is returned. The path is in Falcon convention (forward slashes). If any system error occurs, an IoError is raised.
Creates a directory.
dirMake( dirname, [bFull] ) | |||
dirname | The name of the directory to be created. | ||
bFull | Create also the full pat to the given directory. | ||
Raises: |
|
On success, this function creates the given directory with normal attributes.
It is possible to specify both a relative or absolute path; both the relative and absolute path can contain a subtree specification, that is, a set of directories separated by forward slashes, which lead to the directory that should be created. In example:
dirMake( "top/middle/bottom" )
instructs dirMake to create the directory bottom in a subdirectory "middle", which should already exist. Passing true as second parameter, dirMake will also try to create directories leading to the final destination, if they are missing.
Creates a soft link to a file.
dirMakeLink( source, dest ) | |
source | The original file path. |
dest | The path to the link file. |
The path of both source and dest parameter is to be expressed in Falcon convention (forward slashes), and can be both relative to the working directory or absolute.
Currently, the function works only on UNIX systems; Windows platforms have recently added this functionality, but they are still not supported by this function at the moment.
On success, the function returns true. On failure, it returns false. In case the function is not supported, it just returns false. (Comments are welcome).
On systems supporting symbolic links, returns the linked file.
dirReadLink( linkPath ) | |
linkPath | A path to a symbolic link. |
If the target file in the linkPath parameter is a symbolic link and can be read, the return value will be a string containing the file the link is pointing to. Otherwise, the function will return nil. Function will return nil also on system where symbolic links are not supported.
Removes an empty directory.
dirRemove( dir ) | |||
dir | The path to the directory to be removed. | ||
Raises: |
|
The function removes an empty directory. On failure an IoError with code 1012 will be raised.
Changes UNIX group to a directory entry.
fileChgroup( path, groupId ) | |||
path | A file or otherwise valid directory entry. | ||
groupId | The new group id. | ||
Raises: |
|
This function changes the group ownership of the given file on POSIX systems.
Changes UNIX access right to a directory entry.
fileChmod( path, mode ) | |||
path | A file or otherwise valid directory entry. | ||
mode | The new access mode. | ||
Raises: |
|
This function will work only on POSIX systems. The file access mode will be set along the octal access right defined by POSIX. See man 3 chmod for details.
Changes UNIX owner to a directory entry.
fileChown( path, ownerId ) | |||
path | A file or otherwise valid directory entry. | ||
ownerId | The new ownerId. | ||
Raises: |
|
This function changes the user ownership of the given file on POSIX systems.
Renames a file locally.
fileMove( sourcePath, destPath ) | |||
sourcePath | The path of the file to be moved. | ||
destPath | The path of the destination file. | ||
Raises: |
|
This function actually renames a file. Usually, it will file if the caller tries to move the file across filesystems (i.e. on different discs).
On failure, an IoError is raised.
Removes a file from the system.
fileRemove( filename ) | |||
filename | The name, relative or absolute path of the file to be removed. | ||
Raises: |
|
This function tries to remove a file from the filesystem. If unsuccessful, an error with code 1015 is raised.
Deterimnes the type of a file.
fileType( filename ) | |
filename | Relative or absolute path to a file. |
Returns: | A valid file type or FILE_TYPE_NOTFOUND if not found. |
This function is useful to know what of what kind of system entry is a certain file, or if it exists at all, without paying the overhead for a full FileStat object being instantiated.
Returned values may be:
or FILE_TYPE_NOTFOUND if the file doesn't exist.
Index | | | Related pages | | | Classes | | | Functions | | | Entities | | | Function Sets | | | Groups |