diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-08 19:24:37 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-08 19:24:37 -0400 |
commit | a8be14a261e3b9034a56805c8f537f730a23fa9e (patch) | |
tree | efed64f7c6d1acf0b73eba8ed555a290690b592a /src/SMAPI | |
parent | 30d6ff42531e5908034a54c856725fdd036abbad (diff) | |
download | SMAPI-a8be14a261e3b9034a56805c8f537f730a23fa9e.tar.gz SMAPI-a8be14a261e3b9034a56805c8f537f730a23fa9e.tar.bz2 SMAPI-a8be14a261e3b9034a56805c8f537f730a23fa9e.zip |
minor fixes for log file purge code (#494)
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Program.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 570a3c55..28523722 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -1274,6 +1274,9 @@ namespace StardewModdingAPI private void PurgeLogFiles() { DirectoryInfo logsDir = new DirectoryInfo(Constants.LogDir); + if (!logsDir.Exists) + return; + foreach (FileInfo logFile in logsDir.EnumerateFiles("*.txt")) { if (logFile.Name.StartsWith(Constants.LogNamePrefix, StringComparison.InvariantCultureIgnoreCase)) @@ -1282,9 +1285,9 @@ namespace StardewModdingAPI { FileUtilities.ForceDelete(logFile); } - catch (Exception ex) + catch (IOException) { - // leave file if it's locked + // ignore file if it's in use } } } |