|
|||||
|
||||||
Related Topics | Other Library Functions |
data type |
vfs.directory |
Library: File system utilities (OMVFS)
Import: omvfs.xmd |
The VFS directory opaque 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 vfs functions.
The OmniMark Virtual File System dynamic link library file ("omvfs.dll") creates the VFS directory data type. The related module file ("omvfs.xmd") defines the interface to that component. To use VFS directory data types in your program, you must import it into your program using a statement like this:
import "omvfs.xmd" prefixed by vfs.
Please refer to Opaque Data Types for a general description of opaque data types and how they are used.
The 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.
vfs.disconnect
- discard a directory connection that is no longer needed.
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 vfs functions.
import "omvfs.xmd" prefixed by vfs. process local vfs.file myFile local vfs.directory myDir local stream attributes-shelf variable . . . set myDir to vfs.connect "file:///omprogs/" . . . set myFile to vfs.open "jean-sibelius.txt" on myDir for vfs.read-mode . . . vfs.describe-file myFile into attributes-shelf output " Name: " || attributes-shelf{"name"} || "%n" output " Size: " || attributes-shelf{"size"} || " bytes%n" do when attributes-shelf{"isdir"} = 0 output " Type: file" || "%n" else output " Type: directory" || "%n" done output "Contents: " || vfs.read myFile || "%n"
This program produces the following output:
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
Copyright © Stilo International plc, 1988-2010.