swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Topics   Other Library Functions  
function  

vfs.connect

 
 

Library: File system utilities (OMVFS)
Import: omvfs.xmd
Return type: directory

Returns: A vfs.directory object for the specified directory.


Declaration

export external directory function connect
                value string location
        on      value directory on-dir optional

Argument definitions

location
The location of the directory you wish to connect to in URL format using the file scheme.
on-dir
A connected vfs.directory object. If a vfs.directory is specified, the location parameter must be a relative URL which will be evaluated relative to the specified vfs.directory object.


Purpose

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

Exceptions

The following exceptions may occur:

    Related Topics
 
Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.