@@ -96,7 +96,9 @@ Satisfactory3DMap::DataView::DataView(std::shared_ptr<Configuration> config)
9696 : config_(std::move(config)),
9797 selectedObject_(nullptr ) {
9898
99+ usePakSetting_ = BoolSetting::create (" UsePakFiles" , false );
99100 gameDirSetting_ = PathSetting::create (" GameDirectory" , PathSetting::PathType::Directory);
101+ config_->registerSetting (usePakSetting_);
100102 config_->registerSetting (gameDirSetting_);
101103
102104 if (gameDirSetting_->getVal ().empty ()) {
@@ -105,19 +107,19 @@ Satisfactory3DMap::DataView::DataView(std::shared_ptr<Configuration> config)
105107 gameDirSetting_->setVal (gameDirs[0 ]);
106108 }
107109 }
108- #ifdef FEATURE_PAK_FILE
109- if (!gameDirSetting_->getVal ().empty ()) {
110- try {
111- pakManager_ = SatisfactorySave::PakManager::create (gameDirSetting_->getVal ());
112- } catch (const std::exception& ex) {
113- spdlog::error (" Error init PakManager: {}" , ex.what ());
114- showErrors_.push_back (std::string (" Error reading game dir: " ) + ex.what ());
110+ if (usePakSetting_->getVal ()) {
111+ if (!gameDirSetting_->getVal ().empty ()) {
112+ try {
113+ pakManager_ = SatisfactorySave::PakManager::create (gameDirSetting_->getVal ());
114+ } catch (const std::exception& ex) {
115+ spdlog::error (" Error init PakManager: {}" , ex.what ());
116+ showErrors_.push_back (std::string (" Error reading game dir: " ) + ex.what ());
117+ }
118+ } else {
119+ spdlog::warn (" No game dir set!" );
120+ showErrors_.emplace_back (" No game dir found! Please go to File > Settings and select a game dir." );
115121 }
116- } else {
117- spdlog::warn (" No game dir set!" );
118- showErrors_.emplace_back (" No game dir found! Please go to File > Settings and select a game dir." );
119122 }
120- #endif
121123
122124 manager_ = std::make_unique<ModelManager>(pakManager_);
123125}
0 commit comments