vfs.directory

data type

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


Purpose

The vfs.directory data type 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 OMVFS functions.

Related OMVFS library functions:

The following functions

are used to establish and discard directory connections. omvfs.directory objects are used by the following OMVFS library functions:

Example

This example shows a connection to a directory being established, and that connection being used by other OMVFS functions.

  import "omvfs.xmd" prefixed by vfs.
  
  process
    local vfs.directory directory-handle
    local vfs.file      file-handle
    local stream        properties variable
  
    set directory-handle to vfs.connect "file:///omprogs/"
    set file-handle      to vfs.open "jean-sibelius.txt" on directory-handle for vfs.read-mode 
  
    vfs.describe-file file-handle into properties
    output "    Name:   " || properties{"name"} || "%n"
    output "    Size:   " || properties{"size"} || " bytes%n"
    do when properties{"isdir"} = 0
      output "    Type:   file" || "%n"
  
    else
      output "    Type:   directory" || "%n"
    done
  
    output "Contents:  " || vfs.reader of file-handle || "%n"

Depending on the state and contents of the file system, this program might produce output such as:

  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

Usage Note

To use omvfs.directory in your program, you must import OMVFS into your program using an import declaration such as:

  import "omvfs.xmd" prefixed by vfs.