Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

Fix UpdateService: now using new asset name instead of old exepath

itsfatduck885fb87baff8
diff --git a/optimizerDuck/optimizerDuck.csproj b/optimizerDuck/optimizerDuck.csproj
index 6c8183f..c40673c 100644
--- a/optimizerDuck/optimizerDuck.csproj
+++ b/optimizerDuck/optimizerDuck.csproj
@@ -9,8 +9,8 @@
<ApplicationIcon>Logo.ico</ApplicationIcon>
<Configurations>Debug;Release</Configurations>
<ApplicationManifest>app.manifest</ApplicationManifest>
- <FileVersion>1.2.1</FileVersion>
- <Version>1.2.1</Version>
+ <FileVersion>1.2.2</FileVersion>
+ <Version>1.2.2</Version>
<NeutralLanguage>en</NeutralLanguage>
<PlatformTarget>x64</PlatformTarget>
<Platforms>AnyCPU;x64</Platforms>
diff --git a/optimizerDuck/src/Core/Services/UpdateService.cs b/optimizerDuck/src/Core/Services/UpdateService.cs
index 2042650..e083895 100644
--- a/optimizerDuck/src/Core/Services/UpdateService.cs
+++ b/optimizerDuck/src/Core/Services/UpdateService.cs
@@ -72,7 +72,7 @@ public class UpdateService
return;
}
- Log.LogInformation($"A new version ({latestVersion}) is available!");
+ Log.LogInformation("A new version ({LatestVersion}) is available!", latestVersionStr);
if (!string.IsNullOrWhiteSpace(latestRelease.Body))
{
@@ -152,6 +152,8 @@ public class UpdateService
Log.LogDebug("New executable path: {ExePath}", exePath);
Log.LogDebug("Current (old) executable path: {OldExePath}", Defaults.ExePath);
+ var newPath = Path.Combine(Defaults.ExeDir, Path.GetFileName(exePath));
+
string script = $"""
Write-Host "Updater script started."
Write-Host "Waiting for main process ({currentProcess.Id}) to exit..."
@@ -159,11 +161,11 @@ public class UpdateService
Write-Host "Main process exited."
Write-Host "Replacing old executable..."
- Copy-Item -Path {exePath} -Destination {Defaults.ExePath} -Force
+ Copy-Item -Path {exePath} -Destination {newPath} -Force
Write-Host "Replacement complete."
Write-Host "Starting updated application..."
- Start-Process -FilePath {Defaults.ExePath}
+ Start-Process -FilePath {newPath}
Write-Host "Cleaning up..."
Remove-Item -Path {exePath} -Force