summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-06-08 19:24:37 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-06-08 19:24:37 -0400
commita8be14a261e3b9034a56805c8f537f730a23fa9e (patch)
treeefed64f7c6d1acf0b73eba8ed555a290690b592a /src/SMAPI
parent30d6ff42531e5908034a54c856725fdd036abbad (diff)
downloadSMAPI-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.cs7
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
}
}
}