コード例 #1
0
ファイル: tenv.cpp プロジェクト: gab3d/opentoonz
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;
  }
}