mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-06-19 23:20:57 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f17a761e2 |
@@ -206,7 +206,6 @@ void ParserAsync(std::string_view Data) {
|
||||
return;
|
||||
case 'U':
|
||||
magic = Data.substr(1);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -163,11 +163,7 @@ std::vector<char> TCPRcvRaw(SOCKET Sock, uint64_t& GRcv, uint64_t Size) {
|
||||
int i = 0;
|
||||
do {
|
||||
// receive at most some MB at a time
|
||||
uint64_t Len = std::min<uint64_t>((Size - Rcv), 1 * 1024 * 1024);
|
||||
if (Len == 0) {
|
||||
error("Download size miscalculation");
|
||||
break;
|
||||
}
|
||||
int Len = std::min(int(Size - Rcv), 1 * 1024 * 1024);
|
||||
int Temp = recv(Sock, &File[Rcv], Len, MSG_WAITALL);
|
||||
if (Temp == -1 || Temp == 0) {
|
||||
debug("Recv returned: " + std::to_string(Temp));
|
||||
@@ -583,12 +579,7 @@ void NewSyncResources(SOCKET Sock, const std::string& Mods, const std::vector<Mo
|
||||
}
|
||||
#endif
|
||||
|
||||
std::error_code ec;
|
||||
fs::copy_file(PathToSaveTo, std::filesystem::path(GetGamePath()) / "mods/multiplayer" / FName, fs::copy_options::overwrite_existing, ec);
|
||||
if (ec) {
|
||||
error(beammp_wide("Error in copy_file during download of ") + beammp_fs_string(PathToSaveTo) + beammp_wide(": ") + Utils::ToWString(ec.message()));
|
||||
break;
|
||||
}
|
||||
fs::copy_file(PathToSaveTo, std::filesystem::path(GetGamePath()) / "mods/multiplayer" / FName, fs::copy_options::overwrite_existing);
|
||||
UpdateModUsage(FName);
|
||||
}
|
||||
WaitForConfirm();
|
||||
|
||||
+32
-2
@@ -4,7 +4,6 @@
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
|
||||
#include <filesystem>
|
||||
#include "Utils.h"
|
||||
#if defined(_WIN32)
|
||||
@@ -257,7 +256,38 @@ void LegitimacyCheck() {
|
||||
}
|
||||
|
||||
if (!steamappsFolderFound) {
|
||||
error("Unsupported Steam installation.");
|
||||
warn("Unsupported Steam installation.");
|
||||
auto userfolderIniPath = homeDir / "/.local/share/BeamNG/BeamNG.drive.ini";
|
||||
if (std::filesystem::exists(userfolderIniPath)) {
|
||||
if (std::ifstream beamngIni(userfolderIniPath); beamngIni.is_open()) {
|
||||
std::string contents((std::istreambuf_iterator(beamngIni)), std::istreambuf_iterator<char>());
|
||||
beamngIni.close();
|
||||
|
||||
if (contents.size() >= 3 && (unsigned char)contents[0] == 0xEF && (unsigned char)contents[1] == 0xBB && (unsigned char)contents[2] == 0xBF) {
|
||||
contents = contents.substr(3);
|
||||
}
|
||||
|
||||
auto ini = Utils::ParseINI(contents);
|
||||
if (ini.empty())
|
||||
lowExit(3);
|
||||
else
|
||||
debug("Successfully parsed BeamNG.Drive.ini");
|
||||
|
||||
if (ini.contains("installPath")) {
|
||||
std::string installPath = std::get<std::string>(ini["installPath"]);
|
||||
installPath.erase(0, installPath.find_first_not_of(" \t"));
|
||||
|
||||
if (installPath = std::filesystem::path(Utils::ExpandEnvVars(installPath)).string(); std::filesystem::exists(installPath)) {
|
||||
GameDir = installPath;
|
||||
debug("GameDir from BeamNG.Drive.ini: " + installPath);
|
||||
} else {
|
||||
lowExit(4);
|
||||
}
|
||||
} else {
|
||||
lowExit(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!libraryFoldersFound) {
|
||||
|
||||
Reference in New Issue
Block a user