Index

Package: Paths

Description

package Support.Paths is

Subprograms & Entries

Add_Extension

function Add_Extension
( path, ext: String;
force: Boolean := False ) return String;
If the path has no extension, or if 'force' is True then the path with the appended extension is returned. Otherwise, the path is returned as-is. The value for 'ext' should not include a leading '.' character.

Ancestor_Dir

function Ancestor_Dir
( fullpath, filename: String ) return String;
If fullpath ends with filename, the ancestor part of fullpath that contains filename will be returned. Otherwise, fullpath will be returned. Example: fullpath => "C:\my_dir\something\file.dat" filename => "something\file.dat" returns "C:\my_dir\"

Executable_Extension

function Executable_Extension return String;
Returns the file extension for executable files on the current OS.

Get_Directory

function Get_Directory
( path: String ) return String;
Returns the directory portion of a full path, including a directory separator at the end.

Get_Extension

function Get_Extension
( path: String ) return String;
Returns the path's file extension without a leading dot character, or an empty string if the path has no file extension.

Get_Filename

function Get_Filename
( path: String ) return String;
Returns the path's filename if it has one, otherwise an empty string is returned.

Home_Directory

function Home_Directory return String;
Returns the platform's home directory. The string will have a trailing directory separator.

Other_Slash

function Other_Slash return String;
Returns the opposite slash of the current platform's directory separator slash character.

Path_Append

function Path_Append
( basePath, extra: String ) return String;
Appends 'extra' onto 'basePath', following path naming conventions by ensuring that extra one directory separator character is inserted between the two path parts. If both 'basePath' and 'extra' are empty then an empty string is returned, otherwise if 'basePath' is empty then 'extra' is returned, or if 'extra' is empty, then 'basePath' is returned.

Remove_Extension

function Remove_Extension
( path: String ) return String;
Returns a path without its file extension. If the path is a directory or the file has no extension, it will be returned as-is.

Set_Working_Directory

procedure Set_Working_Directory
( path: String := "" );
Sets the application's current working directory. If an empty string is given, the working directory will be set to the location of the application's executable, or if the executable is inside a Mac application bundle then the location of the Resources folder.

Slash

function Slash return String;
Returns the current platform's directory separator character.

System_Font_Directory

function System_Font_Directory return String;
Returns the current platform's directory for system fonts.