mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-08-16 00:06:41 +00:00
Fix bug with BP and not having a trailing slash by default
This commit is contained in:
parent
7a4b24d616
commit
f27d3c6120
@ -236,7 +236,7 @@ namespace Utils {
|
||||
for (size_t i = 0; i < sha256_len; i++) {
|
||||
char buf[3];
|
||||
sprintf(buf, "%02x", sha256_value[i]);
|
||||
buf[2] = NULL;
|
||||
buf[2] = '\0';
|
||||
result += buf;
|
||||
}
|
||||
return result;
|
||||
@ -280,7 +280,7 @@ namespace Utils {
|
||||
for (size_t i = 0; i < sha256_len; i++) {
|
||||
char buf[3];
|
||||
sprintf(buf, "%02x", sha256_value[i]);
|
||||
buf[2] = NULL;
|
||||
buf[2] = '\0';
|
||||
result += buf;
|
||||
}
|
||||
return result;
|
||||
|
@ -98,7 +98,7 @@ beammp_fs_string GetEP(const beammp_fs_char* P) {
|
||||
return Ret;
|
||||
}
|
||||
|
||||
beammp_fs_string GetBP(const beammp_fs_char* P) {
|
||||
fs::path GetBP(const beammp_fs_char* P) {
|
||||
fs::path fspath = {};
|
||||
#if defined(_WIN32)
|
||||
beammp_fs_char path[256];
|
||||
@ -202,7 +202,7 @@ void CheckForUpdates(const std::string& CV) {
|
||||
transform(LatestHash.begin(), LatestHash.end(), LatestHash.begin(), ::tolower);
|
||||
beammp_fs_string BP(GetBP() / GetEN()), Back(GetBP() / beammp_wide("BeamMP-Launcher.back"));
|
||||
|
||||
std::string FileHash = Utils::GetSha256HashReallyFastFile(EP);
|
||||
std::string FileHash = Utils::GetSha256HashReallyFastFile(BP);
|
||||
|
||||
if (FileHash != LatestHash && IsOutdated(Version(VersionStrToInts(GetVer() + GetPatch())), Version(VersionStrToInts(LatestVersion)))) {
|
||||
if (!options.no_update) {
|
||||
@ -215,16 +215,16 @@ void CheckForUpdates(const std::string& CV) {
|
||||
"https://backend.beammp.com/builds/launcher?download=true"
|
||||
"&pk="
|
||||
+ PublicKey + "&branch=" + Branch,
|
||||
beammp_wide("new_") + EP, LatestHash);
|
||||
beammp_wide("new_") + BP, LatestHash);
|
||||
std::error_code ec;
|
||||
fs::remove(Back, ec);
|
||||
if (ec == std::errc::permission_denied) {
|
||||
error("Failed to remove old backup file: " + ec.message() + ". Using alternative name.");
|
||||
fs::rename(EP, Back + beammp_wide(".") + Utils::ToWString(FileHash.substr(0, 8)));
|
||||
fs::rename(BP, Back + beammp_wide(".") + Utils::ToWString(FileHash.substr(0, 8)));
|
||||
} else {
|
||||
fs::rename(EP, Back);
|
||||
fs::rename(BP, Back);
|
||||
}
|
||||
fs::rename(beammp_wide("new_") + EP, EP);
|
||||
fs::rename(beammp_wide("new_") + BP, BP);
|
||||
URelaunch();
|
||||
#endif
|
||||
} else {
|
||||
|
@ -39,7 +39,6 @@ int main(int argc, const char** argv) try {
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
GetEP(Utils::ToWString(std::string(argv[0])).c_str());
|
||||
info("BP Path: " + GetBP(Utils::ToWString(std::string(argv[0])).c_str()));
|
||||
|
||||
InitLog();
|
||||
ConfigInit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user