diff --git a/include/Utils.h b/include/Utils.h index 3c8381e..c0f4e21 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -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; diff --git a/src/Startup.cpp b/src/Startup.cpp index f6a7cbc..5cfcb6d 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -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 { diff --git a/src/main.cpp b/src/main.cpp index 0c95cec..b2f9099 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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();