Fixed autoupdate mechanism on Unix-based systems

This commit is contained in:
Toastie 2025-02-19 11:56:45 +13:00
parent 98c82b17ed
commit 78492f83ec
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 11 additions and 3 deletions
EllieHub
EllieHub.csproj
Features/Home/Services

View file

@ -20,7 +20,7 @@
<DebugType>embedded</DebugType>
<!--Version-->
<VersionPrefix>1.0.6.0</VersionPrefix>
<VersionPrefix>1.0.7.0</VersionPrefix>
<!--Avalonia Settings-->
<ApplicationManifest>app.manifest</ApplicationManifest>
@ -58,7 +58,7 @@
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.5" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="SingleFileExtractor.Core" Version="2.2.0" />
<PackageReference Include="SkiaImageView.Avalonia11" Version="1.5.0" />

View file

@ -143,7 +143,15 @@ public sealed class AppResolver : IAppResolver
// Rename the original file from "file" to "file_old".
if (File.Exists(destinationUri))
File.Move(destinationUri, destinationUri + OldFileSuffix, true); // This executes fine
{
if (Environment.OSVersion.Platform is not PlatformID.Unix)
File.Move(destinationUri, destinationUri + OldFileSuffix, true);
else
{
using var moveProcess = ToastieUtilities.StartProcess("mv", [destinationUri, destinationUri + OldFileSuffix]);
await moveProcess.WaitForExitAsync(cToken);
}
}
// Move the new file to the application's directory.
// ...