mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-10-20 07:34:15 +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__)
|
||||
std::filesystem::path GetGamePath() {
|
||||
// Right now only steam is supported
|
||||
struct passwd* pw = getpwuid(getuid());
|
||||
std::string homeDir = pw->pw_dir;
|
||||
static std::filesystem::path Path;
|
||||
if (!Path.empty())
|
||||
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());
|
||||
Ver = Ver.substr(0, Ver.find('.', Ver.find('.') + 1));
|
||||
Path += "current/";
|
||||
Path /= "current/";
|
||||
return Path;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user