Logger now creates the errorlogs dir if it doesn't exist, fixing issue #76

This commit is contained in:
tyler staples 2016-03-28 16:12:26 -07:00
parent 6da92c08b9
commit 07396adb55
1 changed files with 7 additions and 0 deletions

View File

@ -231,6 +231,13 @@ namespace StardewModdingAPI
// ReSharper disable once InconsistentlySynchronizedField // ReSharper disable once InconsistentlySynchronizedField
_logQueue = new ConcurrentQueue<LogInfo>(); _logQueue = new ConcurrentQueue<LogInfo>();
Console.WriteLine(Constants.LogPath); Console.WriteLine(Constants.LogPath);
// If the ErrorLogs dir doesn't exist StreamWriter will throw an exception.
if (!Directory.Exists(Constants.LogDir))
{
Directory.CreateDirectory(Constants.LogDir);
}
_stream = new StreamWriter(Constants.LogPath, false); _stream = new StreamWriter(Constants.LogPath, false);
Console.WriteLine("Created log instance"); Console.WriteLine("Created log instance");
} }