From 1eaa1eb901532441e97d9f2d26018c01ff2aeab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B1=BC=E9=B1=BC?= Date: Wed, 20 May 2020 19:44:48 +0800 Subject: [PATCH 1/2] Make sqlite db path configurable --- TShockAPI/ConfigFile.cs | 4 ++++ TShockAPI/TShock.cs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index e440e241..5d30da0e 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -140,6 +140,10 @@ namespace TShockAPI [Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")] public string StorageType = "sqlite"; + /// The path of sqlite db. + [Description("The path of sqlite db.")] + public string SqliteDBPath = "tshock.sqlite"; + /// The MySQL hostname and port to direct connections to. [Description("The MySQL hostname and port to direct connections to.")] public string MySqlHost = "localhost:3306"; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b3d6e6ef..1142f1bc 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -264,7 +264,8 @@ namespace TShockAPI { if (Config.StorageType.ToLower() == "sqlite") { - string sql = Path.Combine(SavePath, "tshock.sqlite"); + string sql = Path.Combine(SavePath, Config.SqliteDBPath); + Directory.CreateDirectory(Path.GetDirectoryName(sql)); DB = new SqliteConnection(string.Format("uri=file://{0},Version=3", sql)); } else if (Config.StorageType.ToLower() == "mysql") From 27b4a106199a6f2de037bb7f4cc7d45f18db7a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B1=BC=E9=B1=BC?= Date: Wed, 20 May 2020 19:52:17 +0800 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 612bfb4f..878d7744 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. +## Upcoming changes +* Make sqlite db path configurable. (@AxeelAnder) + ## TShock 4.4.0 (Pre-release 4) * Debug logging now provides ConsoleDebug and ILog has been updated to support the concept of debug logs. Debug logs are now controlled by `config.json` instead of by preprocessor debug flag. (@hakusaro) * Removed `/confuse` command and Terraria player data resync from @Zidonuke. (@hakusaro)