diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index 800d03a2..980791fc 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -66,6 +66,10 @@ namespace TShockAPI public static void WriteJsonConfiguration() { + if (!System.IO.Directory.Exists(FileTools.SaveDir)) + { + System.IO.Directory.CreateDirectory(FileTools.SaveDir); + } if (System.IO.File.Exists(FileTools.SaveDir + "config.json")) { return; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 9ae7be08..9e283a61 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -103,6 +103,14 @@ namespace TShockAPI public override void Initialize() { + try + { + FileTools.SetupConfig(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } Log.Initialize(FileTools.SaveDir + "log.txt", LogLevel.All, true); Log.Info("Starting..."); GameHooks.OnPreInitialize += OnPreInit; @@ -471,14 +479,6 @@ namespace TShockAPI void OnPreInit() { - try - { - FileTools.SetupConfig(); - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - } } void OnPostInit()