add cases for empty paths

edit path usages to use filesystem
This commit is contained in:
Anonymous275
2022-08-20 19:51:00 +03:00
parent 4b09048d10
commit 000af36510
6 changed files with 36 additions and 26 deletions

View File

@@ -25,19 +25,28 @@ void Launcher::LoadConfig() {
for (char& c : TargetBuild) c = char(tolower(c));
} else LOG(ERROR) << "Failed to get 'Build' string from config";
if (GamePath.is_string()) BeamRoot = GamePath.as_string()->get();
if (GamePath.is_string()) {
if(!GamePath.as_string()->get().empty()) {
BeamRoot = GamePath.as_string()->get();
} else throw ShutdownException("GamePath cannot be empty");
}
else LOG(ERROR) << "Failed to get 'GamePath' string from config";
if (ProfilePath.is_string()) {
BeamUserPath = ProfilePath.as_string()->get();
if (!BeamUserPath.empty()) {
MPUserPath = BeamUserPath + "\\mods\\multiplayer";
}
auto GameVer = VersionParser(UIData::GameVer).split;
if (!ProfilePath.as_string()->get().empty()) {
BeamUserPath = fs::path(ProfilePath.as_string()->get())/(GameVer[0] + '.' + GameVer[1]);
MPUserPath = BeamUserPath/"mods"/"multiplayer";
} else throw ShutdownException("ProfilePath cannot be empty");
}
else LOG(ERROR) << "Failed to get 'ProfilePath' string from config";
if (CachePath.is_string()) LauncherCache = CachePath.as_string()->get();
else LOG(ERROR) << "Failed to get 'CachePath' string from config";
if (CachePath.is_string()) {
if(!CachePath.as_string()->get().empty()) {
LauncherCache = CachePath.as_string()->get();
} else throw ShutdownException("CachePath cannot be empty");
} else LOG(ERROR) << "Failed to get 'CachePath' string from config";
BeamVersion = UIData::GameVer;
} else {