Skip to content

Commit 6b1be7b

Browse files
committed
Fix an edge case where the launcher can fail to repair itself due to the gitlab barrier getting in the way of attempts to download the latest launcher version
1 parent dcfe0a8 commit 6b1be7b

5 files changed

Lines changed: 9 additions & 10 deletions

File tree

include/self_updater/launcher_update_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Updater {
1515
public:
1616
static constexpr const size_t BUFF_SIZE = 4096;
1717

18-
SelfUpdateCheckResult CheckSelfUpdateAvailability(bool allowPreRelease, std::string& version, std::string& url);
18+
SelfUpdateCheckResult CheckSelfUpdateAvailability(bool allowPreRelease, bool force, std::string& version, std::string& url);
1919
bool DownloadUpdate(const std::string& url, std::string& zipFilename);
2020

2121
private:

self_updater/launcher_update_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ namespace Updater {
213213
Logger::Info("%s: %s\n", prefix, curl::DownloadAsStringResultToLogString(result));
214214
}
215215

216-
LauncherUpdateManager::SelfUpdateCheckResult LauncherUpdateManager::CheckSelfUpdateAvailability(bool allowPreReleases,
216+
LauncherUpdateManager::SelfUpdateCheckResult LauncherUpdateManager::CheckSelfUpdateAvailability(bool allowPreReleases, bool force,
217217
std::string& version, std::string& url) {
218218
Logger::Info("Checking for availability of launcher updates...\n");
219219
curl::DownloadStringResult downloadReleasesResult;
220220
Shared::SteamLauncherUpdateStatus steamUpdateStatus;
221-
if (_updateChecker.IsSelfUpdateAvailable(allowPreReleases, false, version, url, downloadReleasesResult, steamUpdateStatus)) {
221+
if (_updateChecker.IsSelfUpdateAvailable(allowPreReleases, force, version, url, downloadReleasesResult, steamUpdateStatus)) {
222222
Logger::Info("...OK\n");
223223
Logger::Info("New version of the launcher available: %s (can be downloaded from %s)\n", version.c_str(), url.c_str());
224224
return SELF_UPDATE_CHECK_UPDATE_AVAILABLE;

self_updater/self_updater.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,15 +470,15 @@ Updater::UpdateLauncherResult Updater::TryUpdateLauncher(int argc, char** argv,
470470
version = versionGiven;
471471
}
472472

473-
const bool launcherMissing = !std::filesystem::exists(LauncherDllPath);
474-
const bool skipConfirmation = urlGiven || launcherMissing;
473+
const bool forceUpdate = !std::filesystem::exists(LauncherDllPath);
474+
const bool skipConfirmation = urlGiven || forceUpdate;
475475

476476
if (!urlGiven) {
477-
lu::SelfUpdateCheckResult checkResult = updateManager.CheckSelfUpdateAvailability(allowUnstable, version, url);
477+
lu::SelfUpdateCheckResult checkResult = updateManager.CheckSelfUpdateAvailability(allowUnstable, forceUpdate, version, url);
478478

479479
switch (checkResult) {
480480
case lu::SELF_UPDATE_CHECK_UP_TO_DATE:
481-
if (launcherMissing) {
481+
if (forceUpdate) {
482482
Logger::Warn("Launcher DLL missing. Forcing update to version: %s (from %s)\n", version.c_str(), url.c_str());
483483
} else {
484484
Logger::Info("launcher is already up-to-date.\n");

src/isaac_installation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static bool RemoveOldPatchFolder()
357357
try {
358358
fs::remove_all(__patchFolder);
359359
} catch (std::filesystem::filesystem_error& err) {
360-
Logger::Error("Failed to delete patch folder: %s (attempt #%d)", err.what(), attempts);
360+
Logger::Error("Failed to delete patch folder: %s (attempt #%d)\n", err.what(), attempts);
361361
std::this_thread::sleep_for(std::chrono::milliseconds(200));
362362
}
363363
}
@@ -447,7 +447,6 @@ bool InstallationData::PatchIsAvailable(const bool skipOnlineCheck) {
447447

448448
if (result == HASH_OK) {
449449
fs::path fullPath = fs::current_path() / __patchFolder / "exehash.txt";
450-
std::string s = fullPath.string();
451450
if (fs::exists(fullPath)) {
452451
// Read the exe hash and compare it.
453452
std::stringstream buffer;

src/standalone_rgon_folder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ namespace standalone_rgon {
13391339
*/
13401340
if (!Filesystem::Exists(sourceStr)) {
13411341
Logger::Warn("standalone_rgon::CopyFiles: skipping %s as "
1342-
"the source file does not exist", sourceStr);
1342+
"the source file does not exist\n", sourceStr);
13431343
continue;
13441344
}
13451345

0 commit comments

Comments
 (0)