Browse Source

Set PyRunner.HomeDir from settings manager library

pull/5/head^2
Ionite 1 year ago
parent
commit
388ad4191e
No known key found for this signature in database
  1. 3
      StabilityMatrix/Helper/SettingsManager.cs
  2. 4
      StabilityMatrix/Python/PyRunner.cs

3
StabilityMatrix/Helper/SettingsManager.cs

@ -7,6 +7,7 @@ using System.Text.Json.Serialization;
using System.Threading; using System.Threading;
using NLog; using NLog;
using StabilityMatrix.Models; using StabilityMatrix.Models;
using StabilityMatrix.Python;
using Wpf.Ui.Controls.Window; using Wpf.Ui.Controls.Window;
namespace StabilityMatrix.Helper; namespace StabilityMatrix.Helper;
@ -74,8 +75,8 @@ public class SettingsManager : ISettingsManager
// Set static classes requiring library path // Set static classes requiring library path
private void SetStaticLibraryPaths() private void SetStaticLibraryPaths()
{ {
// ArchiveHelper
ArchiveHelper.HomeDir = LibraryDir; ArchiveHelper.HomeDir = LibraryDir;
PyRunner.HomeDir = LibraryDir;
} }
/// <summary> /// <summary>

4
StabilityMatrix/Python/PyRunner.cs

@ -15,8 +15,8 @@ public class PyRunner : IPyRunner
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly string AppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); // Set by ISettingsManager.TryFindLibrary()
private static readonly string HomeDir = Path.Combine(AppDataDir, "StabilityMatrix"); public static string HomeDir { get; set; } = string.Empty;
public static string PythonDir => Path.Combine(HomeDir, "Assets", "Python310"); public static string PythonDir => Path.Combine(HomeDir, "Assets", "Python310");
public static string PythonDllPath => Path.Combine(PythonDir, "python310.dll"); public static string PythonDllPath => Path.Combine(PythonDir, "python310.dll");

Loading…
Cancel
Save