Browse Source

Merge branch 'avalonia' of https://github.com/ionite34/StabilityMatrix into avalonia

pull/55/head
JT 1 year ago
parent
commit
50be4b5e04
  1. 3
      StabilityMatrix.Avalonia/Assets.cs
  2. 22
      StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs

3
StabilityMatrix.Avalonia/Assets.cs

@ -92,8 +92,7 @@ internal static class Assets
/// </summary>
public static async Task ExtractAsset(Uri assetUri, string targetDirectory, bool overwrite = true)
{
var assetPath = assetUri.AbsolutePath;
var assetName = Path.GetFileName(assetPath);
var assetName = Path.GetFileName(assetUri.ToString());
var targetPath = Path.Combine(targetDirectory, assetName);
if (File.Exists(targetPath) && !overwrite)
{

22
StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs

@ -8,6 +8,7 @@ using Avalonia.Platform;
using NLog;
using StabilityMatrix.Core.Exceptions;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes;
using StabilityMatrix.Core.Services;
@ -22,15 +23,15 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private string HomeDir => settingsManager.LibraryDir;
private string AssetsDir => Path.Combine(HomeDir, "Assets");
private string PythonDir => Path.Combine(AssetsDir, "Python310");
private string PythonDllPath => Path.Combine(PythonDir, "python310.dll");
public bool IsPythonInstalled => File.Exists(PythonDllPath);
private DirectoryPath HomeDir => settingsManager.LibraryDir;
private DirectoryPath AssetsDir => HomeDir + "Assets";
private DirectoryPath PythonDir => AssetsDir + "Python310";
private FilePath PythonDllPath => PythonDir + "python310.dll";
public bool IsPythonInstalled => PythonDllPath.Exists;
private string PortableGitInstallDir => Path.Combine(HomeDir, "PortableGit");
public string GitBinPath => Path.Combine(PortableGitInstallDir, "bin");
private DirectoryPath PortableGitInstallDir => HomeDir + "PortableGit";
public string GitBinPath => PortableGitInstallDir + "bin";
public UnixPrerequisiteHelper(IDownloadService downloadService, ISettingsManager settingsManager)
@ -106,7 +107,10 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
// Extract
Logger.Info($"Extracting Python Zip: {downloadPath} to {PythonDir}");
Directory.Delete(PythonDir, true);
if (PythonDir.Exists)
{
await PythonDir.DeleteAsync(true);
}
if (progress != null)
{
await ArchiveHelper.Extract7Z(downloadPath, PythonDir, progress);

Loading…
Cancel
Save