PathUtils

Introduction

The PathUtils module provides an interface to manipulate system variables used as path variables by FileSwitch. That is, variables ending '$Path' which are used as references to multiple paths in filenames.

SWI calls

PathUtils_EnumeratePathSWI &53B80
Enumerate the components of a path variable
R0=

Flags:

Bit(s)Meaning
0Set:Return all components of the path recursively
Clear:Return only leaf components of the path
1-31Reserved, must be 0
R1=Pointer to path to process
R2=Pointer to output buffer
R3=Maximum length of the buffer, or 0 to request length
R4=Opaque context value, or 0 for the first call
R0 - R2preserved
R3=Number of spare bytes in the buffer
R4=Context value, or -1 if complete (and the other registers are invalid)
R5=Variable type that the value was expanded from
R6=Depth the value was expanded from
Interrupts are undefined
Fast interrupts are enabled
Processor is in SVC mode
SWI is not re-entrant

This SWI is used to enumerate the components of a path variables. The path variable is expanded recursively. If R0 bit 0 is set, each path component will be returned in the results, even it is not terminal itself.

PathUtils_JoinPathSWI &53B81
Join a new path to a path variable
R0=

Flags:

Bit(s)Meaning
0Set:Append the supplied path
Clear:Prepend the supplied path
1-31Reserved, must be 0
R1=Pointer to variable name to modify
R2=Pointer to path component to join
R0 - R2preserved
Interrupts are undefined
Fast interrupts are enabled
Processor is in SVC mode
SWI is not re-entrant

This SWI is used to join a path to an existing path variable. If the component already exists in the path variable, it will not be added.

PathUtils_RemovePathSWI &53B82
Remove a path from a path variable
R0=

Flags:

Bit(s)Meaning
0-31Reserved, must be 0
R1=Pointer to variable name to modify
R2=Pointer to path component to remove
R0 - R2preserved
Interrupts are undefined
Fast interrupts are enabled
Processor is in SVC mode
SWI is not re-entrant

This SWI is used to remove a path from an existing path variable. If the component is not present, the variable will not be modified.

*Commands

*AppPath
Append a path component to a path variable
*AppPath path-variable path-component
<path-variable>- name of the path variable to append to
<path-component>- name of the path to append to the variable

This command appends a given path component to a path variable. If the path is already present, it has no effect.

*AppPath Run$Path $.Library.
*PrepPath
Prepend a path component to a path variable
*PrepPath path-variable path-component
<path-variable>- name of the path variable to append to
<path-component>- name of the path to insert at the start of the path variable

This command prepends a given path component to a path variable, inserting the path at the start of the variable's value. If the path is already present, it has no effect.

*PrepPath Run$Path $.Library.
*RemPath
Remove a path component from a path variable
*RemPath path-variable path-component
<path-variable>- name of the path variable to change
<path-component>- name of the path to remove from the path variable

This command removes a given path component from a path variable. If the variable is not present, the variable is not changed.

*RemPath Run$Path $.Library.