fixes
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.IO.Compression;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Compression;
|
||||
using Pilz.Runtime;
|
||||
|
||||
namespace Pilz.Updating.Client;
|
||||
|
||||
@@ -26,6 +28,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
|
||||
public bool UIDarkMode { get; set; }
|
||||
public bool HasUpdates => UpdatePackageInfo != null;
|
||||
public string? Distro { get; set; }
|
||||
public bool MakeAppBinaryExecutable { get; set; } = RuntimeInformationsEx.OSType == OSType.Linux || RuntimeInformationsEx.OSType == OSType.Windows;
|
||||
|
||||
// E v e n t M e t h o d s
|
||||
|
||||
@@ -193,8 +196,27 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
|
||||
Utils.CopyFiles(dataPathDir, destDir);
|
||||
}
|
||||
else if (package.UpdateType == UpdateType.File)
|
||||
Utils.CopyFile(new FileInfo(dataPath), new FileInfo(localInstallPath));
|
||||
{
|
||||
if (packageSource.PackageType == PackageType.File)
|
||||
Utils.CopyFile(new FileInfo(dataPath), new FileInfo(localInstallPath));
|
||||
else if (Directory.GetFiles(dataPath).FirstOrDefault() is { } firstFile)
|
||||
Utils.CopyFile(new FileInfo(firstFile), new FileInfo(localInstallPath));
|
||||
}
|
||||
RaiseStatusChanged(UpdateStatus.Copying, UpdateStatusEvent.PostEvent);
|
||||
|
||||
// Make executable
|
||||
if (MakeAppBinaryExecutable)
|
||||
{
|
||||
switch (package.UpdateType)
|
||||
{
|
||||
case UpdateType.File:
|
||||
Utils.MakeExecutable(localInstallPath);
|
||||
break;
|
||||
case UpdateType.Folder when !string.IsNullOrWhiteSpace(package.ExePath):
|
||||
Utils.MakeExecutable(Path.Combine(localInstallPath, package.ExePath));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Package
|
||||
RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PreEvent);
|
||||
|
||||
Reference in New Issue
Block a user