package Support.Paths is
-- 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.
function Add_Extension( path,
ext : String;
force : Boolean := False ) return String;
pragma Precondition( path'Length > 0 );
pragma Precondition( ext'Length > 0 );
-- 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\"
function Ancestor_Dir( fullpath, filename : String ) return String;
pragma Precondition( fullpath'Length > 0 );
-- Returns the file extension for executable files on the current OS.
function Executable_Extension return String;
-- Returns the directory portion of a full path, including a directory
-- separator at the end.
function Get_Directory( 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.
function Get_Extension( path : String ) return String;
-- Returns the path's filename if it has one, otherwise an empty string is
-- returned.
function Get_Filename( path : String ) return String;
-- Returns the platform's home directory. The string will have a trailing
-- directory separator.
function Home_Directory 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.
function Path_Append( basePath, extra : 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.
function Remove_Extension( path : String ) return 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.
procedure Set_Working_Directory( path : String := "" );
-- Returns the current platform's directory separator character.
function Slash return String;
pragma Postcondition( Slash'Result'Length = 1 );
-- Returns the current platform's directory for system fonts.
function System_Font_Directory return String;
end Support.Paths;