Make sqlite db path configurable
This commit is contained in:
parent
208afe9a7e
commit
1eaa1eb901
2 changed files with 6 additions and 1 deletions
|
|
@ -140,6 +140,10 @@ namespace TShockAPI
|
||||||
[Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")]
|
[Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")]
|
||||||
public string StorageType = "sqlite";
|
public string StorageType = "sqlite";
|
||||||
|
|
||||||
|
/// <summary>The path of sqlite db.</summary>
|
||||||
|
[Description("The path of sqlite db.")]
|
||||||
|
public string SqliteDBPath = "tshock.sqlite";
|
||||||
|
|
||||||
/// <summary>The MySQL hostname and port to direct connections to.</summary>
|
/// <summary>The MySQL hostname and port to direct connections to.</summary>
|
||||||
[Description("The MySQL hostname and port to direct connections to.")]
|
[Description("The MySQL hostname and port to direct connections to.")]
|
||||||
public string MySqlHost = "localhost:3306";
|
public string MySqlHost = "localhost:3306";
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,8 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (Config.StorageType.ToLower() == "sqlite")
|
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));
|
DB = new SqliteConnection(string.Format("uri=file://{0},Version=3", sql));
|
||||||
}
|
}
|
||||||
else if (Config.StorageType.ToLower() == "mysql")
|
else if (Config.StorageType.ToLower() == "mysql")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue