change startup path #69

This commit is contained in:
pypy
2020-07-13 21:30:47 +09:00
parent a787bfb739
commit 7c4563bf9b
4 changed files with 13 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ namespace VRCX
catch
{
}
// Application.StartupPath + "/html/index.html"
// AppDomain.CurrentDomain.BaseDirectory + "/html/index.html"
Browser = new ChromiumWebBrowser(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html/index.html"))
{
DragHandler = new NoopDragHandler(),

View File

@@ -1,6 +1,8 @@
using CefSharp;
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.IO;
using System.Threading;
namespace VRCX
@@ -18,7 +20,8 @@ namespace VRCX
public static void Init()
{
m_Connection = new SQLiteConnection($"Data Source={Application.StartupPath}/VRCX.sqlite3;Version=3;PRAGMA locking_mode=NORMAL;PRAGMA cache_size=10000;PRAGMA temp_store=MEMORY;PRAGMA synchronous=OFF;PRAGMA journal_mode=MEMORY;PRAGMA busy_timeout=1000");
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "VRCX.sqlite3");
m_Connection = new SQLiteConnection($"Data Source=\"{path}\";Version=3;PRAGMA locking_mode=NORMAL;PRAGMA cache_size=10000;PRAGMA temp_store=MEMORY;PRAGMA synchronous=OFF;PRAGMA journal_mode=MEMORY;PRAGMA busy_timeout=1000", true);
m_Connection.Open();
}

View File

@@ -3,9 +3,10 @@
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Windows.Forms;
namespace VRCX
{
@@ -14,6 +15,7 @@ namespace VRCX
public static VRCXStorage Instance { get; private set; }
private static readonly ReaderWriterLockSlim m_Lock = new ReaderWriterLockSlim();
private static Dictionary<string, string> m_Storage = new Dictionary<string, string>();
private static string m_JsonPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "VRCX.json");
private static bool m_Dirty;
static VRCXStorage()
@@ -26,7 +28,7 @@ namespace VRCX
m_Lock.EnterWriteLock();
try
{
JsonSerializer.Deserialize(Application.StartupPath + "/VRCX.json", ref m_Storage);
JsonSerializer.Deserialize(m_JsonPath, ref m_Storage);
m_Dirty = false;
}
finally
@@ -42,7 +44,7 @@ namespace VRCX
{
if (m_Dirty)
{
JsonSerializer.Serialize(Application.StartupPath + "/VRCX.json", m_Storage);
JsonSerializer.Serialize(m_JsonPath, m_Storage);
m_Dirty = false;
}
}

View File

@@ -10,6 +10,7 @@ using SharpDX.Direct3D11;
using SharpDX.DXGI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
@@ -65,8 +66,8 @@ namespace VRCX
BindFlags = BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.Write
});
m_Browser1 = new Browser(m_Texture1, Application.StartupPath + "/html/vr.html?1");
m_Browser2 = new Browser(m_Texture2, Application.StartupPath + "/html/vr.html?2");
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_Thread = new Thread(() =>
{
var active = false;