MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / _load_settings_text

Method _load_settings_text

utility/pcfg_loader.cpp:314–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314Error ProjectConfigLoader::_load_settings_text(Ref<FileAccess> f, const String &p_path, uint32_t ver_major) {
315 Error err;
316 last_builtin_order = 0;
317
318 if (f.is_null()) {
319 // FIXME: Above 'err' error code is ERR_FILE_CANT_OPEN if the file is missing
320 // This needs to be streamlined if we want decent error reporting
321 return ERR_FILE_NOT_FOUND;
322 }
323
324 VariantParser::StreamFile stream;
325 stream.f = f;
326
327 String assign;
328 Variant value;
329 VariantParser::Tag next_tag;
330
331 int lines = 0;
332 String error_text;
333 String section;
334 config_version = 0;
335
336 while (true) {
337 assign = Variant();
338 next_tag.fields.clear();
339 next_tag.name = String();
340
341 err = VariantParserCompat::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
342 if (err == ERR_FILE_EOF) {
343 return OK;
344 }
345 ERR_FAIL_COND_V_MSG(err != OK, err, "Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted.");
346
347 if (!assign.is_empty()) {
348 if (section.is_empty() && assign == "config_version") {
349 config_version = value;
350 ERR_FAIL_COND_V_MSG(config_version > ProjectSettings::CONFIG_VERSION, ERR_FILE_CANT_OPEN, vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, ProjectSettings::CONFIG_VERSION));
351 } else {
352 if (section.is_empty()) {
353 props[assign] = VariantContainer(value, last_builtin_order++, true);
354 } else {
355 props[section + "/" + assign] = VariantContainer(value, last_builtin_order++, true);
356 }
357 }
358 } else if (!next_tag.name.is_empty()) {
359 section = next_tag.name;
360 }
361 }
362}
363
364struct _VCSort {
365 String name;

Callers

nothing calls this directly

Calls 2

VariantContainerClass · 0.85
clearMethod · 0.45

Tested by

no test coverage detected