data type
|
Library: File system utilities (OMVFS)
Import : omvfs.xmd |
The vfs.directory data type represents a directory location. Once a connection to a directory has been
established using either of these functions, that connection can be used by other OMVFS functions.
The following functions
vfs.connect—create a connection to a directory location expressed using the file scheme
for URLs,
vfs.connect-directory—create a connection to a directory location expressed using the
file scheme for URLs,
vfs.file-directory—get the directory location of the specified file, and
vfs.disconnect—discard a directory connection that is no longer needed,
omvfs.directory objects are used by the following
OMVFS library functions:
vfs.change-directory—change the current working directory.
vfs.copy—copy a file or a directory.
vfs.delete-directory—remove an existing directory from the virtual file system.
vfs.delete-file—remove an existing file from the virtual file system.
vfs.describe—obtain a description of a file or a directory.
vfs.directory-name—return the name of the current working directory.
vfs.link—create a symbolic link for a file or subdirectory. (Unix only)
vfs.list—list the files and/or subdirectories in a directory.
vfs.make-directory—create a new subdirectory under an existing directory on your local
file system.
vfs.move—move a file or a directory.
vfs.open—open a file.
This example shows a connection to a directory being established, and that connection being used by other OMVFS
functions.
import "omvfs.xmd" prefixed by vfs. process local vfs.directory directory-handle local vfs.file file-handle local stream properties variable set directory-handle to vfs.connect "file:///omprogs/" set file-handle to vfs.open "jean-sibelius.txt" on directory-handle for vfs.read-mode vfs.describe-file file-handle into properties output " Name: " || properties{"name"} || "%n" output " Size: " || properties{"size"} || " bytes%n" do when properties{"isdir"} = 0 output " Type: file" || "%n" else output " Type: directory" || "%n" done output "Contents: " || vfs.reader of file-handle || "%n"
Depending on the state and contents of the file system, this program might produce output such as:
Name: file:///omprogs/jean-sibelius.txt
Size: 115 bytes
Type: file
Contents: "Pay no attention to what the critics say; no statue has ever been erected to a critic."
-- Jean Sibelius
To use omvfs.directory in your program, you must import OMVFS into your program using an import
declaration such as:
import "omvfs.xmd" prefixed by vfs.