From 17de486881b7cadae48136dcc846bcff0e5ab4d9 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 30 Nov 2014 13:34:59 +0000 Subject: Only attempt to clear caches if the directory exists --- project2/files/presenterCache.cpp | 4 +++- project2/xml/xmlCache.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/project2/files/presenterCache.cpp b/project2/files/presenterCache.cpp index da63bf3..7c81ff8 100644 --- a/project2/files/presenterCache.cpp +++ b/project2/files/presenterCache.cpp @@ -252,7 +252,9 @@ class FilePresenterCacheLoader : public ElementLoader::For { void onIdle() override { try { - emptyDir(FilePresenterCache::Store); + if (boost::filesystem::is_directory(FilePresenterCache::Store)) { + emptyDir(FilePresenterCache::Store); + } } catch (...) { Logger()->messagebf(LOG_WARNING, "Failed to purge presenter caches from %s", FilePresenterCache::Store); diff --git a/project2/xml/xmlCache.cpp b/project2/xml/xmlCache.cpp index d6e2e04..649ce02 100644 --- a/project2/xml/xmlCache.cpp +++ b/project2/xml/xmlCache.cpp @@ -90,7 +90,9 @@ class CustomXmlCacheLoader : public ElementLoader::For { void onIdle() override { try { - emptyDir(XmlCache::Store); + if (boost::filesystem::is_directory(XmlCache::Store)) { + emptyDir(XmlCache::Store); + } } catch (...) { Logger()->messagebf(LOG_WARNING, "Failed to purge caches from %s", XmlCache::Store); -- cgit v1.2.3