MCPcopy Create free account
hub / github.com/Cantera/cantera / addDataDirectory

Method addDataDirectory

src/base/application.cpp:284–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284void Application::addDataDirectory(const string& dir)
285{
286 std::unique_lock<std::mutex> dirLock(dir_mutex);
287 if (inputDirs.empty()) {
288 setDefaultDirectories();
289 }
290 string d = stripnonprint(dir);
291
292 // Expand "~/" to user's home directory, if possible
293 if (d.find("~/") == 0 || d.find("~\\") == 0) {
294 char* home = getenv("HOME"); // POSIX systems
295 if (!home) {
296 home = getenv("USERPROFILE"); // Windows systems
297 }
298 if (home) {
299 d = home + d.substr(1, npos);
300 }
301 }
302
303 // Remove any existing entry for this directory
304 auto iter = std::find(inputDirs.begin(), inputDirs.end(), d);
305 if (iter != inputDirs.end()) {
306 inputDirs.erase(iter);
307 }
308
309 // Insert this directory at the beginning of the search path
310 inputDirs.insert(inputDirs.begin(), d);
311}
312
313string Application::findInputFile(const string& name)
314{

Callers 1

addDirectoryFunction · 0.80

Calls 5

stripnonprintFunction · 0.85
eraseMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected