summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index 097663f9c..356e12c8c 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
@@ -69,13 +69,20 @@ namespace HandBrake.ApplicationServices.Utilities
// Delete old and excessivly large files (> ~50MB).
foreach (FileInfo file in logFiles)
{
- if (file.LastWriteTime < DateTime.Now.AddDays(-daysToKeep))
+ try
{
- File.Delete(file.FullName);
+ if (file.LastWriteTime < DateTime.Now.AddDays(-daysToKeep))
+ {
+ File.Delete(file.FullName);
+ }
+ else if (file.Length > 50000000)
+ {
+ File.Delete(file.FullName);
+ }
}
- else if (file.Length > 50000000)
+ catch (Exception)
{
- File.Delete(file.FullName);
+ // Silently ignore files we can't delete. They are probably being used by the app right now.
}
}
}