From 9fd5e48040e68e281dac7cd5f5dc08ecc7d03f09 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 27 Sep 2014 20:40:32 +0100 Subject: [PATCH] Game init by API no longer creates LOOT folder. For #310. --- src/api/api.cpp | 2 +- src/backend/game.cpp | 7 +++++-- src/backend/game.h | 2 +- src/gui/app.cpp | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/api/api.cpp b/src/api/api.cpp index c19a57ef..457b0bbe 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -100,7 +100,7 @@ struct _loot_db_int : public loot::Game { extStringArraySize(0), extRevisionID(nullptr), extRevisionDate(nullptr) { - this->SetDetails("", "", "", "", gamePath, "").Init(); + this->SetDetails("", "", "", "", gamePath, "").Init(false); } ~_loot_db_int() { diff --git a/src/backend/game.cpp b/src/backend/game.cpp index 9558ba7f..3ec39588 100644 --- a/src/backend/game.cpp +++ b/src/backend/game.cpp @@ -352,7 +352,7 @@ namespace loot { return *this; } - Game& Game::Init() { + Game& Game::Init(bool createFolder) { if (id != Game::tes4 && id != Game::tes5 && id != Game::fo3 && id != Game::fonv) { throw error(error::invalid_args, lc::translate("Invalid game ID supplied.").str()); } @@ -382,7 +382,10 @@ namespace loot { } RefreshActivePluginsList(); - CreateLOOTGameFolder(); + + if (createFolder) { + CreateLOOTGameFolder(); + } return *this; } diff --git a/src/backend/game.h b/src/backend/game.h index 1bda234c..1a403ade 100644 --- a/src/backend/game.h +++ b/src/backend/game.h @@ -108,7 +108,7 @@ namespace loot { Game& SetDetails(const std::string& name, const std::string& masterFile, const std::string& repositoryURL, const std::string& repositoryBranch, const std::string& path, const std::string& registry); - Game& Init(); + Game& Init(bool createFolder); bool IsInstalled() const; diff --git a/src/gui/app.cpp b/src/gui/app.cpp index 744e9f09..4c7c4929 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -228,7 +228,7 @@ namespace loot { BOOST_LOG_TRIVIAL(debug) << "Selecting game."; _currentGame = SelectGame(_settings, _games, cmdLineGame); BOOST_LOG_TRIVIAL(debug) << "Initialising game-specific settings."; - _games[_currentGame].Init(); + _games[_currentGame].Init(true); } catch (loot::error &e) { if (e.code() == loot::error::no_game_detected) { @@ -291,7 +291,7 @@ namespace loot { auto it = find(_games.begin(), _games.end(), newGameFolder); _currentGame = std::distance(_games.begin(), it); - _games[_currentGame].Init(); + _games[_currentGame].Init(true); BOOST_LOG_TRIVIAL(debug) << "New game is " << _games[_currentGame].Name(); }