Ensure `SqliteConnection`s are initialised with absolute paths

resolves #3796
This commit is contained in:
YoshiRulz 2025-05-27 08:05:24 +10:00
parent cc59818d6d
commit ffa5738ffc
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using BizHawk.Common.PathExtensions;
using Microsoft.Data.Sqlite; using Microsoft.Data.Sqlite;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
@ -33,7 +35,10 @@ namespace BizHawk.Client.Common
try try
{ {
_dbConnection?.Dispose(); _dbConnection?.Dispose();
_dbConnection = new(new SqliteConnectionStringBuilder { DataSource = name }.ToString()); _dbConnection = new(new SqliteConnectionStringBuilder
{
DataSource = name.MakeAbsolute(),
}.ToString());
_dbConnection.Open(); _dbConnection.Open();
using var initCmds = new SqliteCommand(null, _dbConnection); using var initCmds = new SqliteCommand(null, _dbConnection);
// Allows for reads and writes to happen at the same time // Allows for reads and writes to happen at the same time