Changeset 20080


Ignore:
Timestamp:
04/16/21 10:08:50 (2 months ago)
Author:
tbretz
Message:
Updated where the program looks for fact++.rc: 1) current working directory, 2) executable location, 3) sysconfdir (if available)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Configuration.cc

    r20075 r20080  
    3131   - (3) Database entries
    3232   - (4) Options from the default configuration-file (given by \b --default, defaults to \b program_name.rc)
    33    - (5) Options from the global configuration-file (constructor path + \b fact++.rc)
     33   - (5) Options from the global configuration-file (\b fact++.rc)
    3434   - (6) Environment variables
     35
     36The global configuration-file fact++.rc is search in 1) the current working
     37directory, 2) the directory in which the executable is located, 3) the sysconfdir
     38(defined during compile time).
    3539
    3640Which options are accepted is defined by the program. To get a list
     
    886890//!  - (5)  Read and parse the global configuration file, which is compiled
    887891//!         from the path corresponding to the argument given in the
    888 //!         constructor + "/fact++.rc" (or sysconf-prefix + fact++.rc
    889 //!         if not found), unrecognized options are always
     892//!         "/fact++.rc", unrecognized options are always
    890893//!         allowed. Note that in contradiction to all other options
    891894//!         the options in this file are not checked at all. Hence,
     
    10501053
    10511054    const boost::filesystem::path path(GetName());
    1052     string globalfile = (path.parent_path()/boost::filesystem::path("fact++.rc")).string();
     1055    string globalfile = (boost::filesystem::current_path()/boost::filesystem::path("fact++.rc")).string();
     1056    cerr << "Searching global options in  '" << globalfile << "'" << endl;
     1057
     1058    if (!boost::filesystem::exists(globalfile) && boost::filesystem::current_path()!=path.parent_path())
     1059    {
     1060        globalfile = (path.parent_path()/boost::filesystem::path("fact++.rc")).string();
     1061        cerr << "Searching global options in  '" << globalfile << "'" << endl;
     1062    }
    10531063
    10541064#ifdef PACKAGE_INSTALL_SYSCONFDIR
    10551065    if (!boost::filesystem::exists(globalfile))
     1066    {
    10561067        globalfile = (boost::filesystem::path(PACKAGE_INSTALL_SYSCONFDIR)/boost::filesystem::path("fact++.rc")).string();
     1068        cerr << "Searching global options in  '" << globalfile << "'" << endl;
     1069    }
    10571070#endif
    10581071
Note: See TracChangeset for help on using the changeset viewer.