confirmed working for linux
fixed the database access issue
This commit is contained in:
parent
4ec16d3aa2
commit
396e5c9215
@ -802,7 +802,7 @@ namespace IW4MAdmin
|
|||||||
// hopefully fix wine drive name mangling
|
// hopefully fix wine drive name mangling
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
logPath = Regex.Replace(logPath, @"[A-Z]:", "");
|
logPath = Regex.Replace($"{Path.DirectorySeparatorChar}{logPath}", @"[A-Z]:", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(logPath))
|
if (!File.Exists(logPath))
|
||||||
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace SharedLibraryCore.Database
|
namespace SharedLibraryCore.Database
|
||||||
{
|
{
|
||||||
@ -37,6 +38,10 @@ namespace SharedLibraryCore.Database
|
|||||||
if (string.IsNullOrEmpty(_ConnectionString))
|
if (string.IsNullOrEmpty(_ConnectionString))
|
||||||
{
|
{
|
||||||
string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
|
string currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
|
||||||
|
// allows the application to find the database file
|
||||||
|
currentPath = !RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
|
||||||
|
$"{Path.DirectorySeparatorChar}{currentPath}" :
|
||||||
|
currentPath;
|
||||||
var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = $"{currentPath}{Path.DirectorySeparatorChar}Database.db".Substring(6) };
|
var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = $"{currentPath}{Path.DirectorySeparatorChar}Database.db".Substring(6) };
|
||||||
var connectionString = connectionStringBuilder.ToString();
|
var connectionString = connectionStringBuilder.ToString();
|
||||||
var connection = new SqliteConnection(connectionString);
|
var connection = new SqliteConnection(connectionString);
|
||||||
|
Loading…
Reference in New Issue
Block a user