diff --git a/MainForm.cs b/MainForm.cs index 7cc44f3a..e1ef4b71 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -36,8 +36,8 @@ namespace VRCX catch { } - // AppDomain.CurrentDomain.BaseDirectory + "/html/index.html" - Browser = new ChromiumWebBrowser(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html/index.html")) + // Program.BaseDirectory + "/html/index.html" + Browser = new ChromiumWebBrowser(Path.Combine(Program.BaseDirectory, "html/index.html")) { DragHandler = new NoopDragHandler(), BrowserSettings = diff --git a/Program.cs b/Program.cs index fabe38f1..6c094d89 100644 --- a/Program.cs +++ b/Program.cs @@ -11,8 +11,15 @@ using System.Windows.Forms; namespace VRCX { - public static class Program + public class Program { + public static string BaseDirectory { get; private set; } + + static Program() + { + BaseDirectory = AppDomain.CurrentDomain.BaseDirectory; + } + [STAThread] public static void Main() { diff --git a/SQLite.cs b/SQLite.cs index abb4f154..ebaefd19 100644 --- a/SQLite.cs +++ b/SQLite.cs @@ -22,7 +22,7 @@ namespace VRCX { m_ConnectionLock = new ReaderWriterLockSlim(); - var dataSource = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "VRCX.sqlite3"); + var dataSource = Path.Combine(Program.BaseDirectory, "VRCX.sqlite3"); m_Connection = new SQLiteConnection($"Data Source=\"{dataSource}\";Version=3;PRAGMA locking_mode=NORMAL;PRAGMA busy_timeout=5000", true); } diff --git a/VRCXStorage.cs b/VRCXStorage.cs index 44157d60..b0799aa8 100644 --- a/VRCXStorage.cs +++ b/VRCXStorage.cs @@ -15,7 +15,7 @@ namespace VRCX public static VRCXStorage Instance { get; private set; } private static readonly ReaderWriterLockSlim m_Lock = new ReaderWriterLockSlim(); private static Dictionary m_Storage = new Dictionary(); - private static string m_JsonPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "VRCX.json"); + private static string m_JsonPath = Path.Combine(Program.BaseDirectory, "VRCX.json"); private static bool m_Dirty; static VRCXStorage() diff --git a/VRCXVR.cs b/VRCXVR.cs index d4ec5ca3..75abf1d3 100644 --- a/VRCXVR.cs +++ b/VRCXVR.cs @@ -66,8 +66,8 @@ namespace VRCX BindFlags = BindFlags.ShaderResource, CpuAccessFlags = CpuAccessFlags.Write }); - m_Browser1 = new Browser(m_Texture1, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html/vr.html?1")); - m_Browser2 = new Browser(m_Texture2, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html/vr.html?2")); + m_Browser1 = new Browser(m_Texture1, Path.Combine(Program.BaseDirectory, "html/vr.html?1")); + m_Browser2 = new Browser(m_Texture2, Path.Combine(Program.BaseDirectory, "html/vr.html?2")); m_Thread = new Thread(() => { var active = false; diff --git a/VRForm.cs b/VRForm.cs index 0687a3d3..ce6b8b02 100644 --- a/VRForm.cs +++ b/VRForm.cs @@ -22,7 +22,7 @@ namespace VRCX Instance = this; InitializeComponent(); // - Browser1 = new ChromiumWebBrowser(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html/vr.html?1")) + Browser1 = new ChromiumWebBrowser(Path.Combine(Program.BaseDirectory, "html/vr.html?1")) { DragHandler = new NoopDragHandler(), BrowserSettings = @@ -32,7 +32,7 @@ namespace VRCX }, Dock = DockStyle.Fill, }; - Browser2 = new ChromiumWebBrowser(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html/vr.html?2")) + Browser2 = new ChromiumWebBrowser(Path.Combine(Program.BaseDirectory, "html/vr.html?2")) { DragHandler = new NoopDragHandler(), BrowserSettings = diff --git a/WebApi.cs b/WebApi.cs index 32eba673..0818282d 100644 --- a/WebApi.cs +++ b/WebApi.cs @@ -9,7 +9,7 @@ namespace VRCX { public class WebApi { - private readonly string COOKIE_FILE_NAME = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cookies.dat"); + private readonly string COOKIE_FILE_NAME = Path.Combine(Program.BaseDirectory, "cookies.dat"); public static WebApi Instance { get; private set; } private CookieContainer _cookieContainer;