|
|||||
|
||||||
Related Syntax | Other Library Functions |
function |
vfs.connect |
Library: General, File system utilities (OMVFS)
Import: omvfs.xmd |
Return type: directory Returns: A vfs.directory object for the specified directory. |
export external directory function connect value stream location on value directory on-dir optional
Argument definitions
You can use vfs.connect
to create a connection to a directory. The connection will be represented by a vfs.directory
object. While it is usable now, this functionality is intended chiefly for use in a future version of OMVFS that will support a variety of network protocols such as HTTP and FTP. These protocols require a vfs.directory object to retain state information. This is not required with the local file system.
vfs.connect is a general form of the connect functionality that determines the type of connection to make based on the protocol specified in the URL used to specify the resource to connect to. vfs.connect-directory
is a specific form of this functionality intended for use with the local file system.
All functions in the OMVFS library that take directory information (or that assume the current working directory) can also take anvfs.directory
object via the on-dir parameter (heralded by on
). As a general rule, you should specify locations using file system paths when working with the current working directory, and URLs when working with vfs.directory
objects. (In practice some crossover between the two forms is allowed, but this facility should be used with care to ensure consistency.)
The following program creates a connection to a directory. The connection is represented by a vfs.directory object:
import "omvfs.xmd" prefixed by vfs. process local vfs.directory Chicago . set Chicago to vfs.connect "file:///myPrograms/"
The following program creates a connection relative to an existing vfs.directory
object:
import "omvfs.xmd" prefixed by vfs. process local vfs.directory Toronto local vfs.directory Montreal . . . set Montreal to vfs.connect "file:///Olympics/History_In_Canada/" . . . set Toronto to vfs.connect "../Facilities/" on Montreal
The following exceptions may occur: