Configuration now loads up prior to the files being accessed.
This commit is contained in:
parent
ea18dec857
commit
95c1710b55
2 changed files with 12 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue