1. package Support.Paths is 
  2.  
  3.     -- If the path has no extension, or if 'force' is True then the path with 
  4.     -- the appended extension is returned. Otherwise, the path is returned 
  5.     -- as-is. The value for 'ext' should not include a leading '.' character. 
  6.     function Add_Extension( path, 
  7.                             ext   : String; 
  8.                             force : Boolean := False ) return String; 
  9.     pragma Precondition( path'Length > 0 ); 
  10.     pragma Precondition( ext'Length > 0 ); 
  11.  
  12.     -- If fullpath ends with filename, the ancestor part of fullpath that 
  13.     -- contains filename will be returned. Otherwise, fullpath will be returned. 
  14.     -- 
  15.     -- Example: 
  16.     --   fullpath => "C:\my_dir\something\file.dat" 
  17.     --   filename => "something\file.dat" 
  18.     --   returns "C:\my_dir\" 
  19.     function Ancestor_Dir( fullpath, filename : String ) return String; 
  20.     pragma Precondition( fullpath'Length > 0 ); 
  21.  
  22.     -- Returns the file extension for executable files on the current OS. 
  23.     function Executable_Extension return String; 
  24.  
  25.     -- Returns the directory portion of a full path, including a directory 
  26.     -- separator at the end. 
  27.     function Get_Directory( path : String ) return String; 
  28.  
  29.     -- Returns the path's file extension without a leading dot character, or an 
  30.     -- empty string if the path has no file extension. 
  31.     function Get_Extension( path : String ) return String; 
  32.  
  33.     -- Returns the path's filename if it has one, otherwise an empty string is 
  34.     -- returned. 
  35.     function Get_Filename( path : String ) return String; 
  36.  
  37.     -- Returns the platform's home directory. The string will have a trailing 
  38.     -- directory separator. 
  39.     function Home_Directory return String; 
  40.  
  41.     -- Returns the opposite slash of the current platform's directory separator 
  42.     -- slash character. 
  43.     function Other_Slash return String; 
  44.  
  45.     -- Appends 'extra' onto 'basePath', following path naming conventions by 
  46.     -- ensuring that extra one directory separator character is inserted between 
  47.     -- the two path parts. If both 'basePath' and 'extra' are empty then an 
  48.     -- empty string is returned, otherwise if 'basePath' is empty then 'extra' 
  49.     -- is returned, or if 'extra' is empty, then 'basePath' is returned. 
  50.     function Path_Append( basePath, extra : String ) return String; 
  51.  
  52.     -- Returns a path without its file extension. If the path is a directory or 
  53.     -- the file has no extension, it will be returned as-is. 
  54.     function Remove_Extension( path : String ) return String; 
  55.  
  56.     -- Sets the application's current working directory. If an empty string is 
  57.     -- given, the working directory will be set to the location of the 
  58.     -- application's executable, or if the executable is inside a Mac 
  59.     -- application bundle then the location of the Resources folder. 
  60.     procedure Set_Working_Directory( path : String := "" ); 
  61.  
  62.     -- Returns the current platform's directory separator character. 
  63.     function Slash return String; 
  64.     pragma Postcondition( Slash'Result'Length = 1 ); 
  65.  
  66.     -- Returns the current platform's directory for system fonts. 
  67.     function System_Font_Directory return String; 
  68.  
  69. end Support.Paths;