Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void Create(string connectionString)
// Copy our blank(ish) wal mode sqlite database to its final location.
try
{
EnsureDatabaseDirectory(original.DataSource);
File.Copy(tempFile, original.DataSource, true);
}
catch (Exception ex)
Expand All @@ -104,4 +105,13 @@ public void Create(string connectionString)
_logger.LogWarning(ex, "Unable to cleanup temporary sqlite database file {path}", tempFile);
}
}

private static void EnsureDatabaseDirectory(string dataSource)
{
var directoryPath = Path.GetDirectoryName(dataSource);
if (string.IsNullOrEmpty(directoryPath) is false && Directory.Exists(directoryPath) is false)
{
Directory.CreateDirectory(directoryPath);
}
}
}