diff --git a/CHANGELOG.md b/CHANGELOG.md index c8b9cb83..e0563d49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * Update player spawn related things to 1.4. `Terraria.Player.Spawn` method now has a required argument, `PlayerSpawnContext context`. (@AxeelAnder) +* 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) 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 727526f2..a8a164d0 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")