diff options
author | Carl <slxxls92@gmail.com> | 2016-03-29 01:42:27 +0100 |
---|---|---|
committer | Carl <slxxls92@gmail.com> | 2016-03-29 01:42:27 +0100 |
commit | 26b914d61deb1c95aa306576cc8cd007593db80d (patch) | |
tree | 86a14b53d05e389a6e03cc31b31efaa21a854c3a | |
parent | 44967669961e6b9dc6e028caa806abf466c2cbf3 (diff) | |
parent | d2e909fa02354bf037faa907002b86799064ca97 (diff) | |
download | SMAPI-26b914d61deb1c95aa306576cc8cd007593db80d.tar.gz SMAPI-26b914d61deb1c95aa306576cc8cd007593db80d.tar.bz2 SMAPI-26b914d61deb1c95aa306576cc8cd007593db80d.zip |
Merge pull request #77 from tstaples/master
Fixed issue #76: Logger would throw an exception when LogDir didn't exist.
-rw-r--r-- | StardewModdingAPI/Logger.cs | 7 |
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"); } |