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 dot 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 current platform's common application data directory. This is 
  23.     -- where the standard application resources may have been installed. 
  24.     function App_Data_Directory return String; 
  25.  
  26.     -- Returns the file extension for executable files on the current OS without 
  27.     -- a leading dot character. 
  28.     function Executable_Extension return String; 
  29.  
  30.     -- Returns the directory portion of a full path, including a directory 
  31.     -- separator at the end. 
  32.     function Get_Directory( path : String ) return String; 
  33.  
  34.     -- Returns the path's file extension without a leading dot character, or an 
  35.     -- empty string if the path has no file extension. 
  36.     function Get_Extension( path : String ) return String; 
  37.  
  38.     -- Returns the path's filename if it has one, otherwise an empty string is 
  39.     -- returned. 
  40.     function Get_Filename( path : String ) return String; 
  41.  
  42.     -- Returns the platform's home directory. The string will have a trailing 
  43.     -- directory separator. 
  44.     function Home_Directory return String; 
  45.  
  46.     -- Returns the opposite slash of the current platform's directory separator 
  47.     -- slash character. 
  48.     function Other_Slash return String; 
  49.  
  50.     -- Appends 'extra' onto 'basePath', following path naming conventions by 
  51.     -- ensuring that extra one directory separator character is inserted between 
  52.     -- the two path parts. If both 'basePath' and 'extra' are empty then an 
  53.     -- empty string is returned, otherwise if 'basePath' is empty then 'extra' 
  54.     -- is returned, or if 'extra' is empty, then 'basePath' is returned. 
  55.     function Path_Append( basePath, extra : String ) return String; 
  56.  
  57.     -- Returns a path without its file extension. If the path is a directory or 
  58.     -- the file has no extension, it will be returned as-is. 
  59.     function Remove_Extension( path : String ) return String; 
  60.  
  61.     -- Removes all trailing slashes (forward and backward) from tail of 'path'. 
  62.     function Remove_Trailing_Slash( path : String ) return String; 
  63.  
  64.     -- Opens the directory of 'path' in the platform's GUI and selects the 
  65.     -- specific file in 'path', if it points to an existing file. If the 
  66.     -- directory of 'path' does not exist then nothing happens. 
  67.     procedure Reveal_Path( path : String ); 
  68.  
  69.     -- Sets the application's current working directory. If an empty string is 
  70.     -- given, the working directory will be set to the location of the 
  71.     -- application's executable, or if the executable is inside a Mac 
  72.     -- application bundle then the location of the Resources folder. 
  73.     procedure Set_Working_Directory( path : String := "" ); 
  74.  
  75.     -- Returns the current platform's directory separator character. 
  76.     function Slash return String; 
  77.     pragma Postcondition( Slash'Result'Length = 1 ); 
  78.  
  79.     -- Returns the current platform's directory for system fonts. 
  80.     function System_Font_Directory return String; 
  81.  
  82. end Support.Paths;