Index

Package: Paths

Description

package Support.Paths is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

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 dot 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\"

App_Data_Directory

function App_Data_Directory return String;
Returns the current platform's common application data directory. This is where the standard application resources may have been installed.

Executable_Extension

function Executable_Extension return String;
Returns the file extension for executable files on the current OS without a leading dot character.

Execution_Directory

function Execution_Directory return String;
Returns the directory containing the executable file, or, if the executable is running on OS X inside an .app bundle, the bundle's Resources directory.

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.

Make_Dir

function Make_Dir
( path: String ) return Boolean;
Recursively creates directory 'path', returning True on success or False on error. If the directory already exists, True will be returned.

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.

Remove_Trailing_Slash

function Remove_Trailing_Slash
( path: String ) return String;
Removes all trailing slashes (forward and backward) from tail of 'path'.

Reveal_Path

procedure Reveal_Path
( path: String );
Opens the directory of 'path' in the platform's GUI and selects the specific file in 'path', if it points to an existing file. If the directory of 'path' does not exist then nothing happens.

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.

Temp_Directory

function Temp_Directory return String;
Returns the current platform's temporary directory for temporary files.