From 388ad4191ecd781195b116ccbb66af2f85263c87 Mon Sep 17 00:00:00 2001 From: Ionite Date: Mon, 26 Jun 2023 04:33:03 -0400 Subject: [PATCH] Set PyRunner.HomeDir from settings manager library --- StabilityMatrix/Helper/SettingsManager.cs | 3 ++- StabilityMatrix/Python/PyRunner.cs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/StabilityMatrix/Helper/SettingsManager.cs b/StabilityMatrix/Helper/SettingsManager.cs index 14a14529..c35c4731 100644 --- a/StabilityMatrix/Helper/SettingsManager.cs +++ b/StabilityMatrix/Helper/SettingsManager.cs @@ -7,6 +7,7 @@ using System.Text.Json.Serialization; using System.Threading; using NLog; using StabilityMatrix.Models; +using StabilityMatrix.Python; using Wpf.Ui.Controls.Window; namespace StabilityMatrix.Helper; @@ -74,8 +75,8 @@ public class SettingsManager : ISettingsManager // Set static classes requiring library path private void SetStaticLibraryPaths() { - // ArchiveHelper ArchiveHelper.HomeDir = LibraryDir; + PyRunner.HomeDir = LibraryDir; } /// diff --git a/StabilityMatrix/Python/PyRunner.cs b/StabilityMatrix/Python/PyRunner.cs index daf8874c..6cb155b5 100644 --- a/StabilityMatrix/Python/PyRunner.cs +++ b/StabilityMatrix/Python/PyRunner.cs @@ -14,9 +14,9 @@ public record struct PyVersionInfo(int Major, int Minor, int Micro, string Relea public class PyRunner : IPyRunner { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - - private static readonly string AppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - private static readonly string HomeDir = Path.Combine(AppDataDir, "StabilityMatrix"); + + // Set by ISettingsManager.TryFindLibrary() + public static string HomeDir { get; set; } = string.Empty; public static string PythonDir => Path.Combine(HomeDir, "Assets", "Python310"); public static string PythonDllPath => Path.Combine(PythonDir, "python310.dll");