Skip to content

Commit 92dafd2

Browse files
committed
Use absolute path for sqlite database file
Hopefully to prevent UnauthorizedAccessException errors when app is started by Windows
1 parent 1867ad9 commit 92dafd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

GChan/Data/DataController.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using GChan.Trackers;
2+
using System;
23
using System.Collections.Generic;
34
using System.Data.SQLite;
45
using System.IO;
@@ -14,7 +15,7 @@ class DataController
1415

1516
private const string DATABASE_FILENAME = "trackers.db";
1617
private static readonly string DATABASE_FOLDERNAME = "data";
17-
private static readonly string DATABASE_PATH = DATABASE_FOLDERNAME + "/" + DATABASE_FILENAME;
18+
private static readonly string DATABASE_PATH = Path.Combine(AppContext.BaseDirectory, DATABASE_FOLDERNAME, DATABASE_FILENAME);
1819
private static readonly string DATABASE_CONNECTION_STRING = "DataSource=" + DATABASE_PATH;
1920

2021
/// <summary>

0 commit comments

Comments
 (0)