vfsConnect

function

Library: File system utilities (OMVFS legacy)
Include: omvfs.xin

Returns: a vfsDir to the connected directory


Declaration
define external vfsDir function vfsConnect
 value stream absolute-URL
or
define external vfsDir function vfsConnect
 value stream relative-URL
 on value vfsDir dir

Argument definitions

absolute-URL
is the location of the directory on the local file system you wish to connect to. This parameter must be an absolute URL using the file scheme.
relative-URL
is the location of the directory on the local file system you wish to connect to. This parameter must be a relative URL using the file scheme and with the specified vfsDir object as its base.
dir
is a vfsDir object created by connecting to a network resource using either vfsConnect or vfsConnectDir.


Purpose

Use vfsConnect to create a connection to a directory location expressed using the file scheme for URLs on either

  • local file system, or
  • a network resource
and to obtain a vfsDir for the connected directory. (See also vfsConnectDir .)

Requirements

You must include the following line at the beginning of your OmniMark program:

 include "omvfs.xin"

The location supplied for absolute-URL must:

  • exist and be a directory (else external exception VFS301)
  • be expressed in absolute URL format (else external exception VFS102), and
  • be expressed using the File scheme for URLs (else external exception VFS001)

The location supplied for relative-URL must:

  • exist and be a directory (else external exception VFS301)
  • be expressed in relative URL format based on the current working directory for dir (else external exception VFS101), and
  • be expressed using the File scheme for URLs (else external exception VFS001)

The vfsDir object dir must:

  • represent an existing connection made using vfsConnect or vfsConnectDir (else external exception VFS100).
  • represent a connection made using the File scheme (else external exception VFS001).

Usage Notes

Any connection made with this function can be reused by other vfs functions. This allows you to keep the number of connections to a minimum. Note: You must save the vfsDir component as a local or a global vfsDir variable to be able to reuse it this way.

General OS operation failure exceptions will return external exception VFS300. The accompanying text will contain details on the reason for the exception.

External exception VFS111 is thrown if an URL supplied as a parameter to this function contains invalid encoding.

External exception VFS004 is thrown if the URL exceeds system length limits.

For complete details on the format of absolute URLs and valid encoding, see Internet Standard RFC 1738: Uniform Resource Locators.

For complete details on the format of relative URLs, see Internet Standard RFC 1808: Relative Uniform Resource Locators.

Example #1: Opening a connection to a directory on the local file system.

The local file system directory location is expressed as an URL, and not as a local file system path.

 include "omvfs.xin"
 
 process
 local vfsDir Chicago
 	 .
 set Chicago to vfsConnect "file:///myPrograms/"

Example #2: Opening a connection to a directory on a network resource

The local or global vfsDir you are reusing must still be connected.

 include "omvfs.xin"
 
 process
 local vfsDir Toronto
 local vfsDir Montreal
 	. . .
 set Montreal to vfsConnect "file:///Olympics/History_In_Canada/"
 	. . .
 set Toronto to vfsConnect "../Facilities/"
 	on Montreal

Other Library Functions

AltStyle によって変換されたページ (->オリジナル) /