aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2024-09-01 00:33:26 +0200
committer GitHub <noreply@github.com>2024-09-01 00:33:26 +0200
commit429765a8cdc93cc8975d2676d04cb628c21064a4 (patch)
treeb8a3b192e33aa0498e4b418f69576c02259cc8fd /src/openvic-simulation
parent6c88ecaf2d158dfff1e0b88f0509782e1a15ae3d (diff)
parent4fbc0692f80afc6ac1c6108fda2a4e7ecf06558b (diff)
Merge pull request #189 from OpenVicProject/fix/lexy-vdf-parse-error
Fix handling empty `vic2_steam_lib_directory`
Diffstat (limited to 'src/openvic-simulation')
-rw-r--r--src/openvic-simulation/dataloader/Vic2PathSearch.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/openvic-simulation/dataloader/Vic2PathSearch.cpp b/src/openvic-simulation/dataloader/Vic2PathSearch.cpp
index ccd55d1..a23d0ce 100644
--- a/src/openvic-simulation/dataloader/Vic2PathSearch.cpp
+++ b/src/openvic-simulation/dataloader/Vic2PathSearch.cpp
@@ -1,3 +1,5 @@
+#include <filesystem>
+
#include <openvic-dataloader/detail/CallbackOStream.hpp>
#include <lexy-vdf/KeyValues.hpp>
@@ -159,7 +161,7 @@ static fs::path _search_for_game_path(fs::path hint_path = {}) {
// Steam Library's directory that will contain Victoria 2
fs::path vic2_steam_lib_directory;
- fs::path current_path = hint_path;
+ fs::path current_path = std::filesystem::weakly_canonical(hint_path, error_code);
// If hinted path is directory that contains steamapps
bool is_steamapps = false;
@@ -288,7 +290,7 @@ static fs::path _search_for_game_path(fs::path hint_path = {}) {
// If we could not confirm Victoria 2 was installed via the default Steam installation
bool is_common_folder = false;
- if (!vic2_install_confirmed) {
+ if (!vic2_install_confirmed && !vic2_steam_lib_directory.empty()) {
auto parser = lexy_vdf::Parser::from_file(vic2_steam_lib_directory);
if (!parser.parse()) {
// Could not find or load appmanifest_42960.acf, report error as warning