| 106 | bool allowInternalConfig = true; |
| 107 | |
| 108 | bool loadConfig() |
| 109 | { |
| 110 | bool success = false; |
| 111 | std::ifstream configFile(configPath); |
| 112 | if (configFile.is_open()) { |
| 113 | MESSAGEL("Load config from " << configPath); |
| 114 | success = Config::loadConfig(configFile); |
| 115 | } |
| 116 | else { |
| 117 | std::filesystem::path defaultConfigPath = CommandLine::getDefaultConfigPath(); |
| 118 | configFile.open(defaultConfigPath); |
| 119 | if (configFile.is_open()) { |
| 120 | MESSAGEL("Load config from " << defaultConfigPath); |
| 121 | success = Config::loadConfig(configFile); |
| 122 | } |
| 123 | else if (allowInternalConfig) { |
| 124 | if (!Config::InternalConfig.empty()) { |
| 125 | std::istringstream internalConfig(Config::InternalConfig); |
| 126 | success = Config::loadConfig(internalConfig); |
| 127 | } |
| 128 | else |
| 129 | ERRORL("This version is not built with an internal config. " |
| 130 | "Must specify an external config!"); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if (success && Config::ClearHashAfterConfigLoaded) |
| 135 | Search::Threads.clear(true); |
| 136 | |
| 137 | return success; |
| 138 | } |
| 139 | |
| 140 | std::filesystem::path getModelFullPath(std::filesystem::path modelPath) |
| 141 | { |
no test coverage detected