summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyler staples <tyler.a.staples@gmail.com>2016-03-28 16:12:26 -0700
committertyler staples <tyler.a.staples@gmail.com>2016-03-28 16:12:26 -0700
commit07396adb5540cdd022277415202e74229c133a6a (patch)
tree86a14b53d05e389a6e03cc31b31efaa21a854c3a
parent6da92c08b9b6885faf46d8a260f4956c72b6a32a (diff)
downloadSMAPI-07396adb5540cdd022277415202e74229c133a6a.tar.gz
SMAPI-07396adb5540cdd022277415202e74229c133a6a.tar.bz2
SMAPI-07396adb5540cdd022277415202e74229c133a6a.zip
Logger now creates the errorlogs dir if it doesn't exist, fixing issue #76
-rw-r--r--StardewModdingAPI/Logger.cs7
1 files changed, 7 insertions, 0 deletions
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<LogInfo>();
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");
}