|
@@ -58,14 +58,18 @@ namespace IES.ExamServer
|
|
|
builder.Services.AddHttpClient();
|
|
|
builder.Services.AddSignalR();
|
|
|
builder.Services.AddHttpContextAccessor();
|
|
|
-
|
|
|
+ //此处能在Linux及MacOS运行,
|
|
|
+ //Windows的路径是LocalApplicationData Path: C:\Users\john\AppData\Local
|
|
|
+ //Linux的路径是LocalApplicationData Path: /home/john/.local/share,
|
|
|
+ //MacOS 的路径LocalApplicationData Path: /Users/john/Library/Application Support
|
|
|
string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
|
|
- string dbpath = $"{localAppDataPath}\\ExamServer\\LiteDB";
|
|
|
+ //string dbpath = $"{localAppDataPath}\\ExamServer\\LiteDB";
|
|
|
+ string dbpath = Path.Combine(localAppDataPath, "ExamServer", "LiteDB");
|
|
|
if (!System.IO.Directory.Exists(dbpath))
|
|
|
{
|
|
|
System.IO.Directory.CreateDirectory(dbpath);
|
|
|
}
|
|
|
- string liteDBPath = $"Filename={dbpath}\\data.db;Connection=shared";
|
|
|
+ string liteDBPath = $"Filename={dbpath}/data.db;Connection=shared";
|
|
|
|
|
|
var connections_LiteDB = new List<LiteDBFactoryOptions>
|
|
|
{
|