mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
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:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user