Refactor Game::CreateLOOTGameFolder().

Removing the private function and moving its code into Game::Init(),
since it's pretty simple and only ever called from that one place.
This commit is contained in:
Oliver Hamlet
2015-07-12 18:37:26 +01:00
parent be502bf893
commit db63eb83b9
2 changed files with 9 additions and 16 deletions
+9 -13
View File
@@ -66,7 +66,15 @@ namespace loot {
}
if (createFolder) {
CreateLOOTGameFolder();
//Make sure that the LOOT game path exists.
try {
if (fs::exists(g_path_local) && !fs::exists(g_path_local / FolderName()))
fs::create_directory(g_path_local / FolderName());
}
catch (fs::filesystem_error& e) {
BOOST_LOG_TRIVIAL(error) << "Could not create LOOT folder for game. Details: " << e.what();
throw error(error::path_write_fail, lc::translate("Could not create LOOT folder for game. Details:").str() + " " + e.what());
}
}
LoadOrderHandler::Init(*this, gameLocalAppData);
@@ -188,18 +196,6 @@ namespace loot {
return false;
}
void Game::CreateLOOTGameFolder() {
//Make sure that the LOOT game path exists.
try {
if (fs::exists(g_path_local) && !fs::exists(g_path_local / FolderName()))
fs::create_directory(g_path_local / FolderName());
}
catch (fs::filesystem_error& e) {
BOOST_LOG_TRIVIAL(error) << "Could not create LOOT folder for game. Details: " << e.what();
throw error(error::path_write_fail, lc::translate("Could not create LOOT folder for game. Details:").str() + " " + e.what());
}
}
std::list<Game> ToGames(const std::list<GameSettings>& settings) {
return list<Game>(settings.begin(), settings.end());
}
-3
View File
@@ -68,9 +68,6 @@ namespace loot {
Masterlist masterlist;
MetadataList userlist;
std::unordered_map<std::string, Plugin> plugins; //Map so that plugin data can be edited.
private:
//Creates directory in LOOT folder for LOOT's game-specific files.
void CreateLOOTGameFolder();
};
std::list<Game> ToGames(const std::list<GameSettings>& settings);