From 07396adb5540cdd022277415202e74229c133a6a Mon Sep 17 00:00:00 2001 From: tyler staples Date: Mon, 28 Mar 2016 16:12:26 -0700 Subject: [PATCH] Logger now creates the errorlogs dir if it doesn't exist, fixing issue #76 --- StardewModdingAPI/Logger.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/StardewModdingAPI/Logger.cs b/StardewModdingAPI/Logger.cs index 8a2241da..0d69b6ec 100644 --- a/StardewModdingAPI/Logger.cs +++ b/StardewModdingAPI/Logger.cs @@ -231,6 +231,13 @@ namespace StardewModdingAPI // ReSharper disable once InconsistentlySynchronizedField _logQueue = new ConcurrentQueue(); 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); Console.WriteLine("Created log instance"); }