PathUtils


Contents


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_EnumeratePath
(SWI &53B80)

Enumerate the components of a path variable
On entry
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
On exit
R0-2preserved
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
Interrupts are undefined
Fast interrupts are enabled
Processor mode
Processor is in SVC mode
Re-entrancy
SWI is not re-entrant
Use

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.

Related APIs
None

PathUtils_JoinPath
(SWI &53B81)

Join a new path to a path variable
On entry
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
On exit
R0-2preserved
Interrupts
Interrupts are undefined
Fast interrupts are enabled
Processor mode
Processor is in SVC mode
Re-entrancy
SWI is not re-entrant
Use

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.

Related * commands
*AppPath, *PrepPath

PathUtils_RemovePath
(SWI &53B82)

Remove a path from a path variable
On entry
R0=

Flags:

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

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.

Related * commands
*RemPath

*Commands


*AppPath

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

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

Example
*AppPath Run$Path $.Library.
Related * commands
*PrepPath
Related SWIs
PathUtils_JoinPath

*PrepPath

Prepend a path component to a path variable
Syntax
*PrepPath <path-variable> <path-component>
Parameters
<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
Use

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.

Example
*PrepPath Run$Path $.Library.
Related * commands
*AppPath
Related SWIs
PathUtils_JoinPath

*RemPath

Remove a path component from a path variable
Syntax
*RemPath <path-variable> <path-component>
Parameters
<path-variable>- name of the path variable to change
<path-component>- name of the path to remove from the path variable
Use

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

Example
*RemPath Run$Path $.Library.
Related SWIs
PathUtils_RemovePath

Document information

Maintainer(s):
History:
RevisionDateAuthorChanges
16 Oct 2006gerphInitial version
  • Original documentation.
28 May 2023gerphPRM-in-XML version
  • Recreated documentation in PRM-in-XML format.
Disclaimer:

© Gerph, 2006-2023.