Returns a string containing the full path to the file in which the statement is contained.


path = __FILE_DIR()
Returns:path (string) – containing the full path to the file which contains the usage of __FILE_DIR.


  • __FILE_DIR is only available for use inside a program file. It cannot be used at the GAUSS command prompt.

  • A common use of __FILE_DIR is to locate a data file which is in the same directory as the code file, but may not be the current working directory. For example, the GAUSS example file gmmfitiv_auto.e is located in the GAUSS examples directory. This example code needs to load a dataset which is also located in the GAUSS examples directory. For this purpose, it uses the line:

    // Create fully pathed dataset file name string
    auto_dset = __FILE_DIR $+ "auto.dat";

    This code will set the string “auto.dat” equal to the full path to the GAUSS examples directory followed by “auto.dat”, regardless of your system or installation directory. The actual contents of this string will vary depending on your system, but will look similar to this:

    // Mac
    // Windows
    // Linux
  • Note that __FILE_DIR is technically a GAUSS define, therefore it cannot be appended with parentheses like this:

     // Adding parentheses to the end is incorrect

See also

Functions getGAUSSHome()