mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #21165 from bencsikandrei/refactor/simplify-linux-get-install-path
Refactor GetInstallPath for linux
This commit is contained in:
commit
04e8a25c44
|
@ -97,25 +97,23 @@ namespace Platform
|
||||||
}
|
}
|
||||||
// 2. Try {${exeDir},${cwd},/}/{data,standard system app directories}
|
// 2. Try {${exeDir},${cwd},/}/{data,standard system app directories}
|
||||||
// exeDir should come first to allow installing into build dir
|
// exeDir should come first to allow installing into build dir
|
||||||
std::vector<std::string> prefixes;
|
// clang-format off
|
||||||
auto exePath = Platform::GetCurrentExecutablePath();
|
const std::string prefixes[]{
|
||||||
prefixes.push_back(Path::GetDirectory(exePath));
|
Path::GetDirectory(Platform::GetCurrentExecutablePath()),
|
||||||
prefixes.push_back(GetCurrentWorkingDirectory());
|
GetCurrentWorkingDirectory(),
|
||||||
prefixes.push_back("/");
|
"/"
|
||||||
static const char* SearchLocations[] = {
|
};
|
||||||
|
static constexpr u8string_view SearchLocations[] = {
|
||||||
"/data",
|
"/data",
|
||||||
"../share/openrct2",
|
"../share/openrct2",
|
||||||
# ifdef ORCT2_RESOURCE_DIR
|
|
||||||
// defined in CMakeLists.txt
|
|
||||||
ORCT2_RESOURCE_DIR,
|
|
||||||
# endif // ORCT2_RESOURCE_DIR
|
|
||||||
"/usr/local/share/openrct2",
|
"/usr/local/share/openrct2",
|
||||||
"/var/lib/openrct2",
|
"/var/lib/openrct2",
|
||||||
"/usr/share/openrct2",
|
"/usr/share/openrct2",
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
for (const auto& prefix : prefixes)
|
for (const auto& prefix : prefixes)
|
||||||
{
|
{
|
||||||
for (auto searchLocation : SearchLocations)
|
for (const auto searchLocation : SearchLocations)
|
||||||
{
|
{
|
||||||
auto prefixedPath = Path::Combine(prefix, searchLocation);
|
auto prefixedPath = Path::Combine(prefix, searchLocation);
|
||||||
LOG_VERBOSE("Looking for OpenRCT2 data in %s", prefixedPath.c_str());
|
LOG_VERBOSE("Looking for OpenRCT2 data in %s", prefixedPath.c_str());
|
||||||
|
|
Loading…
Reference in New Issue