fixes
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>4.4.0</Version>
|
<Version>4.4.3</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System.IO.Compression;
|
using System.Diagnostics;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using Pilz.Runtime;
|
||||||
|
|
||||||
namespace Pilz.Updating.Client;
|
namespace Pilz.Updating.Client;
|
||||||
|
|
||||||
@@ -26,6 +28,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
|
|||||||
public bool UIDarkMode { get; set; }
|
public bool UIDarkMode { get; set; }
|
||||||
public bool HasUpdates => UpdatePackageInfo != null;
|
public bool HasUpdates => UpdatePackageInfo != null;
|
||||||
public string? Distro { get; set; }
|
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
|
// E v e n t M e t h o d s
|
||||||
|
|
||||||
@@ -193,9 +196,28 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
|
|||||||
Utils.CopyFiles(dataPathDir, destDir);
|
Utils.CopyFiles(dataPathDir, destDir);
|
||||||
}
|
}
|
||||||
else if (package.UpdateType == UpdateType.File)
|
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);
|
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
|
// Delete Package
|
||||||
RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PreEvent);
|
RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PreEvent);
|
||||||
if (packageSource.PackageType == PackageType.Zip)
|
if (packageSource.PackageType == PackageType.Zip)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using Pilz.Runtime;
|
using Pilz.Runtime;
|
||||||
|
|
||||||
namespace Pilz.Updating.Client;
|
namespace Pilz.Updating.Client;
|
||||||
@@ -68,4 +69,21 @@ public static class Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void MakeExecutable(string filePath)
|
||||||
|
{
|
||||||
|
var pChmod = new Process
|
||||||
|
{
|
||||||
|
StartInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "chmod",
|
||||||
|
Arguments = $"+x \"{filePath}\"",
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
pChmod.Start();
|
||||||
|
pChmod.WaitForExit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user