file ... is writable

operator

Return type:
Switch
Returns:
true if the system path named by string-expression is writable, false otherwise.
Syntax
file string-expression (is | isnt) writable


Purpose

The file ... is writable test is used to determine if the system path named by string-expression is writable by the OmniMark program. This is useful to avoid a program error when writing out to a file. Using isnt instead of is will reverse the results.

This test will succeed if the named system path exists and is writable, or if the named system path does not exist, but can be created.

Example

The following program shows how file ... is writable is used to avoid attempting to write to a file that cannot be be written to:

  process
     local stream errors 
  
     do unless file "errors.txt" is writable
        put #log "ERROR: %"errors.txt%" is not writable.%n"
        halt with 1
     done
  
     open errors as file "errors.txt"