From 78492f83ec2e50b8f311acf9e275a21417b19841 Mon Sep 17 00:00:00 2001
From: Toastie <toastie@toastiet0ast.com>
Date: Wed, 19 Feb 2025 11:56:45 +1300
Subject: [PATCH] Fixed autoupdate mechanism on Unix-based systems

---
 EllieHub/EllieHub.csproj                       |  4 ++--
 EllieHub/Features/Home/Services/AppResolver.cs | 10 +++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/EllieHub/EllieHub.csproj b/EllieHub/EllieHub.csproj
index ec3089c..abddccd 100644
--- a/EllieHub/EllieHub.csproj
+++ b/EllieHub/EllieHub.csproj
@@ -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" />
diff --git a/EllieHub/Features/Home/Services/AppResolver.cs b/EllieHub/Features/Home/Services/AppResolver.cs
index bd540f7..fa3c54e 100644
--- a/EllieHub/Features/Home/Services/AppResolver.cs
+++ b/EllieHub/Features/Home/Services/AppResolver.cs
@@ -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.
                 // ...