MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / constructStoragePath

Method constructStoragePath

plugins/dm.gui/ReadableEditorDialog.cpp:428–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428std::string ReadableEditorDialog::constructStoragePath()
429{
430 // Construct the storage path from Registry keys.
431 std::string storagePath;
432 if (_useDefaultFilename)
433 {
434 bool checkVFS = true;
435 switch (registry::getValue<int>(RKEY_READABLES_STORAGE_FOLDER))
436 {
437 case 0: // Use Mod dir
438 storagePath = GlobalGameManager().getModPath();
439 if (storagePath.empty())
440 {
441 // Mod path not defined. Use base Path
442 storagePath = GlobalRegistry().get(RKEY_ENGINE_PATH) + "base/";
443 wxutil::Messagebox::ShowError(_("Mod path not defined. Using Base path..."), this);
444 }
445 storagePath += XData::XDATA_DIR;
446 break;
447 case 1: // Use Mod Base dir
448 storagePath = GlobalGameManager().getModBasePath();
449 if (storagePath.empty())
450 {
451 // Mod Base Path not defined. Use Mod path or base path successively.
452 storagePath = GlobalGameManager().getModPath();
453 if (storagePath.empty())
454 {
455 storagePath = GlobalRegistry().get(RKEY_ENGINE_PATH) + "base/";
456 wxutil::Messagebox::ShowError(_("Mod Base path not defined, neither is Mod path. Using Engine path..."),
457 this);
458 storagePath += XData::XDATA_DIR;
459 break;
460 }
461 wxutil::Messagebox::ShowError(_("Mod Base path not defined. Using Mod path..."), this);
462 }
463 storagePath += XData::XDATA_DIR;
464 break;
465 default: // Use custom folder
466 storagePath = GlobalRegistry().get(RKEY_READABLES_CUSTOM_FOLDER);
467 if (storagePath.empty())
468 {
469 // Custom path not defined. Use Mod path or base path successively.
470 storagePath = GlobalGameManager().getModPath();
471 if (storagePath.empty())
472 {
473 storagePath = GlobalRegistry().get(RKEY_ENGINE_PATH) + "base/";
474 wxutil::Messagebox::ShowError(_("Mod Base path not defined, neither is Mod path. Using Engine path..."), this);
475 storagePath += XData::XDATA_DIR;
476 break;
477 }
478 storagePath += XData::XDATA_DIR;
479 wxutil::Messagebox::ShowError(_("Mod Base path not defined. Using Mod path..."), this);
480 break;
481 }
482 storagePath += "/" +_mapBasedFilename;
483 checkVFS = false;
484 break;
485 }

Callers

nothing calls this directly

Calls 11

path_is_absoluteFunction · 0.85
getModPathMethod · 0.80
getModBasePathMethod · 0.80
_Function · 0.50
to_stringFunction · 0.50
formatFunction · 0.50
emptyMethod · 0.45
getMethod · 0.45
findFileMethod · 0.45
compareMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected