From 2b354e49247c0ecb1361b71448bfa4c0d95fd48e Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 8 Sep 2024 11:03:22 -0500 Subject: [PATCH 1/2] Search in AppContext. --- src/IKVM.Runtime/JVM.Properties.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/IKVM.Runtime/JVM.Properties.cs b/src/IKVM.Runtime/JVM.Properties.cs index 0efbd1fa2..d0d1e5701 100644 --- a/src/IKVM.Runtime/JVM.Properties.cs +++ b/src/IKVM.Runtime/JVM.Properties.cs @@ -128,6 +128,13 @@ static string GetHomePath() if (Directory.Exists(Path.GetFullPath(Path.Combine(ikvmHomeEntry.BasePath, ikvmHomeEntry.Value)))) return Path.GetFullPath(Path.Combine(ikvmHomeEntry.BasePath, ikvmHomeEntry.Value)); +#if NET + // specified home directory in runtime.json, where path is relative to application + if (AppContext.GetData("IKVM.Home") is string confHome && !string.IsNullOrWhiteSpace(confHome)) + if (Directory.Exists(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, confHome)))) + return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, confHome)); +#endif + #if NETFRAMEWORK // attempt to find settings in legacy app.config try @@ -153,6 +160,13 @@ static string GetHomePath() if (ResolveHomePathFromRoot(Path.GetFullPath(Path.Combine(ikvmHomeRootEntry.BasePath, ikvmHomeRootEntry.Value))) is string ikvmHomeRootPath) return ikvmHomeRootPath; +#if NET + // specified home root directory in runtime.json, where path is relative to application + if (AppContext.GetData("IKVM.Home.Root") is string confHomeRoot && !string.IsNullOrWhiteSpace(confHomeRoot)) + if (ResolveHomePathFromRoot(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, confHomeRoot)) is string confHomeRootPath) + return confHomeRootPath; +#endif + #if NETFRAMEWORK // attempt to find settings in legacy app.config try From ab37f930f482653513cfea14b472593a6c7a1e1b Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 8 Sep 2024 11:14:52 -0500 Subject: [PATCH 2/2] bump