Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter SixFile Functions (continued)

6.4 File String and Path Functions

6.4.1 Overview

This section covers string functions specifically designed for files, folders and URI processing.

6.4.2 Paths

Since Legato runs in a windows environment, it accepts both forward and back slashes as path delimiters. When working with URIs all slashes should be forward slashes. Many functions have internal limits on path sizes of MAP_PATH_SIZE or 512 bytes. Note that many Windows functions are limited to a maximum path size of 266 characters.

Unless otherwise specified, file string functions do not support UNICODE.

Throughout the documentation, folder, directory and path are used. Folder and directory are essentially the same, a folder containing a series of files and other folders, and a directory contains a list of files and folders in a folder. A path can specify all or part of a location.

A fully qualified path simply means that the string specifies a unique unambiguous location from the script’s perspective. For example, “C:\Windows\”. A relative path means that it must be combined with a base to become a fully qualified path. For example, “Windows\”.

A path can contain a drive letter as a fixed device such as a hard drive or SD card or a mapped network drive. Other methods of identifying network and other devices is a UNC or Universal Naming Convention. In all cases, drives, folders or files are referenced. In the case of web servers, a URL or Uniform Resource Locator references a number of items such as files servers, streams, and various protocols.

By convention, Windows paths use a backslash delimiter and non-Windows a forward slash delimiter. In later versions Windows, the slashes can be used universally to reference files. However, there are certain functions and support routines that will not accept forward slashes such as Windows Explorer which can impact the BrowseFolder, BrowseOpenFile, BrowseOpenFiles and BrowseSaveFile functions.

6.4.3 Path String Functions

Assembling Paths, UNCs and URLs:

AddPathDelimiter — Appends an appropriate path delimiter, if required.

AddPaths — Adds to paths by taking into account limb connectors (i.e., ’..’).

ApplyDefaultPath — Applies/qualifies path of target with a base if the target is not qualified.

CatPaths — Concatenates paths (simple appends and removes extra ‘//’ characters).

CreateRelativePath — Combines a base and target path to create a relative path.

ExpandEnvironmentalStrings — Expands strings containing environmental variable names.

MakePathRelative — Makes target a relative path (if possible) based on provided path.

PathLevelUp — Cuts path one level up.

PathToMSDelimiters — Changes all slashes to backslashes.

PathToURIDelimiters — Changes all backslashes to slashes.

QualifyURL — Qualifies target using a base path.

Parsing Paths, UNCs, URLs:

ClipFileExtension — Clips the file extension from a filename or path.

ClipIDReference — Clips off an ID reference such as #name.

ClipQueryOrID — Clips off either query or named ID.

ClipURIFilename — Removes the filename query or ID from a URI. This routine assumes that a path after the authority ends at the section with an extension, query or named position.

ClipURIPath — Removes all text after the domain/authority.

CollapsePath — Collapses path (removes middle) to limit size for display.

DecodeURI — Decodes a complete URL or part of a URI.

EncodeURIComponent — Encodes URI components (URN sections).

GetAdjustURLFilename — Gets the filename from URL.

GetDrive — Gets the drive letter (as upper case).

GetExtension — Gets the file extension with leading period.

GetFilename — Gets the filename component of a path.

GetFilePath — Gets path from a qualified/relative filename.

GetIDReference — Gets the ID off a URL (#name).

GetPathConnector — Returns path connector character.

GetUNC — Gets the UNC designator from a filename and path.

GetUNCShareName — Gets a network map share name.

GetURIAuthority — Gets the authority (domain name) from URI.

GetURIComponents — Cracks a URI and returns all the components.

GetURIHost — Returns only the host name (domain) from the referenced name from URI.

GetURIName — Gets the name from URI.

GetURIPath — Gets the Path and Filename from URI.

GetURIQuery — Gets the query data from URI.

GetURISchemeString — Returns the scheme as a string.

GetURISchemeType — Returns the scheme as URI_SCHEME_ code.

HasURIScheme — Checks for a scheme.

URIArrayToQuery — Implodes a series of query parameters into a URI query string.

URIQueryToArray — Explodes a URI query string into an array of query components.

Reference:

GetApplicationDataFolder — Gets the Application Data path with an optional base path flag.

GetApplicationDataCommonFolder — Gets the Application Common Data path with an optional base path flag.

GetApplicationDataLocalFolder — Gets the Application Local Data path with an optional base path flag.

GetApplicationExecuteFolder — Gets the primary module path (application path).

GetApplicationFilename — Gets the primary module file and path (application).

GetApplicationSettingsName — Gets the application settings (INI) filename and path.

GetDesktopFolder — Retrieves the User’s Desktop path.

GetProgramFilesFolder — Gets the folder for program files.

GetSystemFolder — Gets Windows/OS path.

GetTempFileFolder — Gets the user’s temporary area or area designated for the application.

Testers:

IsFilenameValid — Tests for a valid filename by checking the characters. (Does not check for an EDGAR compliant name.)

IsInTempFolder — Tests for the filename and path in the scope of the application temp area.

IsPath — Tests for any path characters.

IsPathDrive — Tests for the path having a drive root.

IsPathQualified — Tests for the path being a root (starts with scheme, drive, UNC or /).

IsPathUNC — Tests for the path having a UNC root.

IsPathQualifiedWeb — Tests for the path having a web scheme root

IsPathQualifiedWindows — Tests for the path having a windows root.

IsPathTopLevel — Tests for the path being windows root (i.e., D:\ or \\dog\).

IsSamePath — Compares the path portion of two qualified filenames.