bool TEnv::setArgPathValue(std::string key, std::string value) { EnvGlobals *eg = EnvGlobals::instance(); // in case of "-TOONZROOT" , set the all unregistered paths if (key == getRootVarName()) { TFilePath rootPath(value); eg->setStuffDir(rootPath); for (auto itr = systemPathMap.begin(); itr != systemPathMap.end(); ++itr) { std::string k = getSystemVarPrefix() + (*itr).first; std::string val = value + "\\" + (*itr).second; // set all unregistered values if (eg->getArgPathValue(k) == "") eg->setArgPathValue(k, val); } return true; } else { for (auto itr = systemPathMap.begin(); itr != systemPathMap.end(); ++itr) { // found the corresponding registry key if (key == getSystemVarPrefix() + (*itr).first) { eg->setArgPathValue(key, value); return true; } } // registry key not found. failed to register return false; } }
TFilePathSet TEnv::getSystemVarPathSetValue(std::string varName) { TFilePathSet lst; EnvGlobals *eg = EnvGlobals::instance(); // if the path is registered by command line argument, then use it std::string value = eg->getArgPathValue(varName); if (value == "") value = eg->getSystemVarValue(varName); int len = (int)value.size(); int i = 0; int j = value.find(';'); while (j != std::string::npos) { std::string s = value.substr(i, j - i); lst.push_back(TFilePath(s)); i = j + 1; if (i >= len) return lst; j = value.find(';', i); } if (i < len) lst.push_back(TFilePath(value.substr(i))); return lst; }
TFilePath TEnv::getSystemVarPathValue(std::string varName) { EnvGlobals *eg = EnvGlobals::instance(); return TFilePath(eg->getSystemVarValue(varName)); }