summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2022-10-23 10:44:24 +0200
committerGitHub <noreply@github.com>2022-10-23 10:44:24 +0200
commit100121c0b1cb66d9be58f522bc06aefcddaed648 (patch)
treeef39840eb327fe4f9108365514167a003f7a071d /Source
parent636c25513030ec567cc90998085a8e8017ca6d9e (diff)
parent08c019608d741f46dcec9cf49269c2020ca9c8d7 (diff)
Merge pull request #11197 from shuffle2/updater
WinUpdater: fix renaming of Updater
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/UpdaterCommon/UpdaterCommon.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
index 72f357bf76..9bed359221 100644
--- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp
+++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
@@ -464,16 +464,10 @@ bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
// after entire update has completed, and have it delete our relocated executable. For now we
// just let the relocated file hang around.
// It is enough to match based on filename, don't need File/VolumeId etc.
- if (op.filename == self_filename)
- {
- auto reloc_path = self_path;
- reloc_path.replace_filename("Updater.2.exe");
- if (!MoveFile(self_path.wstring().c_str(), reloc_path.wstring().c_str()))
- {
- fprintf(log_fp, "Failed to move %s.\n", op.filename.c_str());
- // Just let the Copy fail, later.
- }
- }
+ const bool is_self = op.filename == self_filename;
+#else
+ // On other platforms, the renaming is handled by Dolphin before running the Updater.
+ const bool is_self = false;
#endif
std::string contents;
@@ -488,7 +482,7 @@ bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
fprintf(log_fp, "File %s was already up to date. Partial update?\n", op.filename.c_str());
continue;
}
- else if (!op.old_hash || contents_hash != *op.old_hash)
+ else if (!op.old_hash || contents_hash != *op.old_hash || is_self)
{
if (!BackupFile(path))
return false;