MCPcopy Create free account
hub / github.com/dhbloo/rapfi / loadConfig

Function loadConfig

Rapfi/command/command.cpp:108–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106bool allowInternalConfig = true;
107
108bool 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
140std::filesystem::path getModelFullPath(std::filesystem::path modelPath)
141{

Callers 3

mainFunction · 0.85
thinkFunction · 0.85
reloadConfigFunction · 0.85

Calls 3

getDefaultConfigPathFunction · 0.85
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected