data type
Library: File system utilities (OMVFS legacy)
Include: omvfs.xin |
The vfsDir OMX component 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 vfsDir OMX component. The related include file ("omvfs.xin") defines the interface to that component. To use vfsDir OMX components in your program, you must include the following include statement in your program:
include "omvfs.xin"
Please refer to OMX Components for a general description of OMX components and how they are used.
The functions
vfsConnect
- create a connection to a directory location expressed using the file scheme for URLs.
vfsConnectDir
- create a connection to a directory location expressed using the file scheme for URLs.
vfsFileDir
- get the directory location of the specified file.
vfsDisconnect
- discard a directory connection that is no longer needed.
vfsChangeDir
- change the current working directory.
vfsCopy
- copy a file or a directory.
vfsDeleteDir
- remove an existing directory from the virtual file system.
vfsDeleteFile
- remove an existing file from the virtual file system.
vfsDescribe
- obtain a description of a file or a directory.
vfsDirName
- return the name of the current working directory.
vfsLink
- create a symbolic link for a file or subdirectory. (Unix only)
vfsList
- list the files and/or subdirectories in a directory.
vfsMakeDir
- create a new subdirectory under an existing directory on your local file system.
vfsMove
- move a file or a directory.
vfsOpen
- open a file.
This example shows a connection to a directory being established, and that connection being used by other vfs functions.
include "omvfs.xin" process local vfsFile myFile local vfsDir myDir local stream attributes-shelf variable . . . set myDir to vfsConnect "file:///omprogs/" . . . set myFile to vfsOpen "jean-sibelius.txt" on myDir for vfs-read . . . vfsDescribeFile 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: " || vfsRead 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