mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-10-26 22:20:24 +00:00
Fix user-path override on linux
This commit is contained in:
1 parent
92cf7a9c67
commit
293fde884a
1 file changed
+20
-5
+20
-5
@@ -117,14 +117,29 @@ std::filesystem::path GetGamePath() {
|
|||||||
}
|
}
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
std::filesystem::path GetGamePath() {
|
std::filesystem::path GetGamePath() {
|
||||||
// Right now only steam is supported
|
static std::filesystem::path Path;
|
||||||
struct passwd* pw = getpwuid(getuid());
|
if (!Path.empty())
|
||||||
std::string homeDir = pw->pw_dir;
|
return Path;
|
||||||
|
|
||||||
|
if (options.user_path) {
|
||||||
|
if (std::filesystem::exists(options.user_path)) {
|
||||||
|
Path = options.user_path;
|
||||||
|
debug("Using custom user folder path: " + Path.string());
|
||||||
|
} else
|
||||||
|
warn("Invalid or non-existent path (" + std::string(options.user_path) + ") specified using --user-path, skipping");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Path.empty()) {
|
||||||
|
// Right now only steam is supported
|
||||||
|
struct passwd* pw = getpwuid(getuid());
|
||||||
|
std::string homeDir = pw->pw_dir;
|
||||||
|
|
||||||
|
Path = homeDir + "/.local/share/BeamNG/BeamNG.drive/";
|
||||||
|
}
|
||||||
|
|
||||||
std::string Path = homeDir + "/.local/share/BeamNG/BeamNG.drive/";
|
|
||||||
std::string Ver = CheckVer(GetGameDir());
|
std::string Ver = CheckVer(GetGameDir());
|
||||||
Ver = Ver.substr(0, Ver.find('.', Ver.find('.') + 1));
|
Ver = Ver.substr(0, Ver.find('.', Ver.find('.') + 1));
|
||||||
Path += "current/";
|
Path /= "current/";
|
||||||
return Path;
|
return Path;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user