mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Adjust messages logged on game handle creation
This commit is contained in:
+28
-2
@@ -32,6 +32,31 @@
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace loot {
|
||||
const char* DescribeGameType(GameType gameType) {
|
||||
switch (gameType) {
|
||||
case GameType::tes4:
|
||||
return "The Elder Scrolls IV: Oblivion";
|
||||
case GameType::tes5:
|
||||
return "The Elder Scrolls V: Skyrim";
|
||||
case GameType::fo3:
|
||||
return "Fallout 3";
|
||||
case GameType::fonv:
|
||||
return "Fallout: New Vegas";
|
||||
case GameType::fo4:
|
||||
return "Fallout 4";
|
||||
case GameType::tes5se:
|
||||
return "The Elder Scrolls V: Skyrim Special Edition";
|
||||
case GameType::fo4vr:
|
||||
return "Fallout 4 VR";
|
||||
case GameType::tes5vr:
|
||||
return "The Elder Scrolls V: Skyrim VR";
|
||||
case GameType::tes3:
|
||||
return "The Elder Scrolls III: Morrowind";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
std::filesystem::path ResolvePath(const std::filesystem::path& path) {
|
||||
// is_symlink can throw on MSVC with the message
|
||||
// "symlink_status: The parameter is incorrect."
|
||||
@@ -79,8 +104,9 @@ LOOT_API std::unique_ptr<GameInterface> CreateGameHandle(
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->info(
|
||||
"Attempting to create a game handle with game path \"{}\" "
|
||||
"and local path \"{}\"",
|
||||
"Attempting to create a game handle for game type \"{}\" with game "
|
||||
"path \"{}\" and game local path \"{}\"",
|
||||
DescribeGameType(game),
|
||||
gamePath.u8string(),
|
||||
gameLocalPath.u8string());
|
||||
}
|
||||
|
||||
@@ -62,14 +62,7 @@ Game::Game(const GameType gameType,
|
||||
loadOrderHandler_(type_, gamePath_, localDataPath),
|
||||
conditionEvaluator_(
|
||||
std::make_shared<ConditionEvaluator>(Type(), DataPath())),
|
||||
database_(ApiDatabase(conditionEvaluator_)) {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->info("Initialising load order data for game of type {} at: {}",
|
||||
(int)type_,
|
||||
gamePath_.u8string());
|
||||
}
|
||||
}
|
||||
database_(ApiDatabase(conditionEvaluator_)) {}
|
||||
|
||||
GameType Game::Type() const { return type_; }
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ TEST(SetLoggingCallback, shouldAcceptAMemberFunction) {
|
||||
FAIL();
|
||||
} catch (...) {
|
||||
EXPECT_EQ(
|
||||
"Attempting to create a game handle with game path \"dummy\" "
|
||||
"and local path \"\"",
|
||||
"Attempting to create a game handle for game type \"The Elder Scrolls "
|
||||
"IV: Oblivion\" with game path \"dummy\" and game local path \"\"",
|
||||
testLogger.loggedMessages);
|
||||
|
||||
SetLoggingCallback([](LogLevel, const char *) {});
|
||||
@@ -112,8 +112,8 @@ TEST(SetLoggingCallback, shouldAcceptALambdaFunction) {
|
||||
FAIL();
|
||||
} catch (...) {
|
||||
EXPECT_EQ(
|
||||
"Attempting to create a game handle with game path \"dummy\" "
|
||||
"and local path \"\"",
|
||||
"Attempting to create a game handle for game type \"The Elder Scrolls "
|
||||
"IV: Oblivion\" with game path \"dummy\" and game local path \"\"",
|
||||
loggedMessages);
|
||||
|
||||
SetLoggingCallback([](LogLevel, const char *) {});
|
||||
@@ -134,8 +134,8 @@ TEST(SetLoggingCallback,
|
||||
FAIL();
|
||||
} catch (...) {
|
||||
EXPECT_EQ(
|
||||
"Attempting to create a game handle with game path \"dummy\" "
|
||||
"and local path \"\"",
|
||||
"Attempting to create a game handle for game type \"The Elder Scrolls "
|
||||
"IV: Oblivion\" with game path \"dummy\" and game local path \"\"",
|
||||
loggedMessages);
|
||||
|
||||
SetLoggingCallback([](LogLevel, const char *) {});
|
||||
|
||||
Reference in New Issue
Block a user