[Base] Move CANTERA_DATA environment variable up in search path
The paths added from the CANTERA_DATA environment variable should be searched before hard-coded paths which are determined based on the installation location.
This commit is contained in:
parent
f733fac104
commit
dac5345b56
1 changed files with 22 additions and 22 deletions
|
|
@ -325,6 +325,28 @@ void Application::setDefaultDirectories()
|
|||
// always look in the local directory first
|
||||
inputDirs.push_back(".");
|
||||
|
||||
// if environment variable CANTERA_DATA is defined, then add it to the
|
||||
// search path. CANTERA_DATA may include multiple directory, separated by
|
||||
// the OS-dependent path separator (in the same manner as the PATH
|
||||
// environment variable).
|
||||
#ifdef _WIN32
|
||||
std::string pathsep = ";";
|
||||
#else
|
||||
std::string pathsep = ":";
|
||||
#endif
|
||||
|
||||
if (getenv("CANTERA_DATA") != 0) {
|
||||
string s = string(getenv("CANTERA_DATA"));
|
||||
size_t start = 0;
|
||||
size_t end = s.find(pathsep);
|
||||
while(end != npos) {
|
||||
inputDirs.push_back(s.substr(start, end-start));
|
||||
start = end + 1;
|
||||
end = s.find(pathsep, start);
|
||||
}
|
||||
inputDirs.push_back(s.substr(start,end));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Under Windows, the Cantera setup utility records the installation
|
||||
// directory in the registry. Data files are stored in the 'data'
|
||||
|
|
@ -353,28 +375,6 @@ void Application::setDefaultDirectories()
|
|||
inputDirs.push_back("/Applications/Cantera/data");
|
||||
#endif
|
||||
|
||||
// if environment variable CANTERA_DATA is defined, then add it to the
|
||||
// search path. CANTERA_DATA may include multiple directory, separated by
|
||||
// the OS-dependent path separator (in the same manner as the PATH
|
||||
// environment variable).
|
||||
#ifdef _WIN32
|
||||
std::string pathsep = ";";
|
||||
#else
|
||||
std::string pathsep = ":";
|
||||
#endif
|
||||
|
||||
if (getenv("CANTERA_DATA") != 0) {
|
||||
string s = string(getenv("CANTERA_DATA"));
|
||||
size_t start = 0;
|
||||
size_t end = s.find(pathsep);
|
||||
while(end != npos) {
|
||||
inputDirs.push_back(s.substr(start, end-start));
|
||||
start = end + 1;
|
||||
end = s.find(pathsep, start);
|
||||
}
|
||||
inputDirs.push_back(s.substr(start,end));
|
||||
}
|
||||
|
||||
// CANTERA_DATA is defined in file config.h. This file is written during the
|
||||
// build process (unix), and points to the directory specified by the
|
||||
// 'prefix' option to 'configure', or else to /usr/local/cantera.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue