Skip to content

Commit

Permalink
Use find_similar_file when validating install path, too.
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronVanGeffen authored and janisozaur committed Jan 24, 2018
1 parent 594619b commit 43737a3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/openloco/envionment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ namespace openloco::environment
loco_global_array<char, 257, 0x0050B635> _path_objects;

static fs::path get_sub_path(path_id id);
#ifndef _WIN32
static fs::path find_similar_file(const fs::path& path);
#endif

static bool validate_loco_install_path(const fs::path& path)
{
Expand All @@ -31,7 +34,15 @@ namespace openloco::environment
else
{
auto g1Path = path / get_sub_path(path_id::g1);
return fs::exists(g1Path);
bool g1Exists = fs::exists(g1Path);
#ifndef _WIN32
if (!g1Exists)
{
g1Path = find_similar_file(g1Path);
g1Exists = !g1Path.empty();
}
#endif
return g1Exists;
}
}

Expand Down

0 comments on commit 43737a3

Please sign in to comment.