Skip to content

Commit

Permalink
Support for new style of rawVersion notation. (ParadoxGameConverters#255
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Zemurin authored May 9, 2024
1 parent cb1cf76 commit d75da6d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions GameVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ std::optional<GameVersion> GameVersion::extractVersionByStringFromLauncher(const

line = line.substr(0, pos);

if (!line.empty() && line[0] == 'v')
{
line = line.substr(1, line.length());
}

try
{
return GameVersion(line);
Expand Down
8 changes: 8 additions & 0 deletions tests/GameVersionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,14 @@ TEST(GameVersion_Tests, extractVersionFromLauncherExtractsGameVersion)
EXPECT_EQ(GameVersion("1.31.5"), *version);
}

TEST(GameVersion_Tests, extractVVersionFromLauncherExtractsGameVersion)
{
// They started adding v in front of a version, eg. v1.37.0.0
const auto version = GameVersion::extractVersionFromLauncher("launcher-settings-1.37.json");

EXPECT_EQ(GameVersion("1.37.0"), *version);
}

TEST(GameVersion_Tests, extractVersionFromLauncherReturnsNulloptForMissingFile)
{
const auto version = GameVersion::extractVersionFromLauncher("launcher-settings.json2");
Expand Down
13 changes: 13 additions & 0 deletions tests/TestFiles/launcher-settings-1.37.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"gameId": "eu4",
"displayName": "Europa Universalis IV",
"version": "EU4 v1.37.0.0 Inca (3d19)",
"rawVersion": "v1.37.0.0",
"distPlatform": "steam",
"gameDataPath": "%USER_DOCUMENTS%/Paradox Interactive/Europa Universalis IV",
"ingameSettingsLayoutPath": "settings-layout.json",
"themeFile": "launcher-assets/theme-settings.json",
"browserDlcUrl": "https://www.paradoxplaza.com/games/?prefn1=pdx-brand&amp;prefn2=pdx-type&amp;prefv1=EU4%7CEuropa%20Universalis&amp;prefv2=dlc",
"exePath": "./eu4.exe",
"exeArgs": [ "-enabletelemetry", "-gdpr-compliant" ]
}

0 comments on commit d75da6d

Please sign in to comment.