diff --git a/Application/Server.cs b/Application/Server.cs index 83c4a2c5c..830332d78 100644 --- a/Application/Server.cs +++ b/Application/Server.cs @@ -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)) diff --git a/SharedLibraryCore/Database/DatabaseContext.cs b/SharedLibraryCore/Database/DatabaseContext.cs index c50bcaf1c..f04550e01 100644 --- a/SharedLibraryCore/Database/DatabaseContext.cs +++ b/SharedLibraryCore/Database/DatabaseContext.cs @@ -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);