Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SixFile Functions (continued)

AddPaths Function

Overview

The AddPaths function will combine two paths together and produce a string containing a resultant path.

Syntax/Parameters

Syntax

string = AddPaths ( string base, string target );

Parameters

base

A string containing a base path. The path does not require a trailing slash. base should generally be qualified but it is not required.

target

A string containing an unqualified target path. It cannot contain a root position but may contain one or more leading ‘../’ to perform up branch traversing.

Return Value

Returns a string containing the combined paths or an empty string on failure. Use the GetLastError function to retrieve error information.

Remarks

The AddPaths function takes two input paths and combines them to produce a resultant path. The second path (target) must be relative to the first (base) (i.e., within the same logical volume). The AddPaths function also performs path connector logic to properly resolve ‘..’ connectors to traverse up the path tree. The paths can be Windows or URI style. If they are URI and contain a scheme, the QualifyURL function must be used.

In the event of an error, the GetLastError function may return the following values (OR’ed with ERROR_SOFT):

  AP_SOURCE_NOT_RELATIVE 0x00010000 Target is not relative path
  AP_SOURCE_SYNTAX 0x00020000 Syntax error relative path
  AP_SOURCE_EXCEEDS_ROOT 0x00030000 Up tree '..' went past root
  AP_OVERFLOW 0x00040000 Result is too large (maximum 512 characters)

 

Note that in this situation:

AddPaths("C:\\test\\data\\", "\\data1.txt");

the AddPaths function will return an empty string even though the path operation is technically correct.

The AddPaths function does not check for the validity of the resultant path.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic