vfs.directory-name

function

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

Returns: the current directory for the specified VFS directory object or the local file system


Declaration
export external stream function directory-name
        on      value directory on-dir optional

Argument definitions

on-dir
A connected vfs.directory object.


Purpose

You can use vfs.directory name to return the current working directory:

The following program saves the current working directory, changes directories, performs an operation, and restores the current working directory:

  import "omvfs.xmd" prefixed by vfs.
  
  process
     local stream cwd initial {vfs.directory-name}
     local stream listing variable
     vfs.change-directory "c:\foo\bar"
     vfs.list into listing
     repeat over listing
        output listing || "%n"
     again
     vfs.change-directory cwd

If you specify a vfs.directory, then the function returns the name of the directory represented by the vfs.directory object. The directory name is returned in URL format.

  import "omvfs.xmd" prefixed by vfs.
  
  process
     local stream listing variable
     local vfs.directory dir
     set dir to vfs.connect-directory "file:/c:/foo/bar"
     output vfs.directory-name on dir || "%n"
     vfs.change-directory ".." on dir
     output vfs.directory-name on dir

Exceptions

The following exceptions may occur: