confirmed working for linux

fixed the database access issue
This commit is contained in:
RaidMax 2018-08-01 21:09:22 -05:00
parent 4ec16d3aa2
commit 396e5c9215
2 changed files with 6 additions and 1 deletions

View File

@ -802,7 +802,7 @@ namespace IW4MAdmin
// hopefully fix wine drive name mangling
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
logPath = Regex.Replace(logPath, @"[A-Z]:", "");
logPath = Regex.Replace($"{Path.DirectorySeparatorChar}{logPath}", @"[A-Z]:", "");
}
if (!File.Exists(logPath))

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Data.Sqlite;
using SharedLibraryCore.Interfaces;
using System.Runtime.InteropServices;
namespace SharedLibraryCore.Database
{
@ -37,6 +38,10 @@ namespace SharedLibraryCore.Database
if (string.IsNullOrEmpty(_ConnectionString))
{
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 connectionString = connectionStringBuilder.ToString();
var connection = new SqliteConnection(connectionString);