Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/GameStart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,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
Expand Down
Loading