diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/StorageBackendFile/StorageBackendFile.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/modules/StorageBackendFile/StorageBackendFile.cpp b/src/modules/StorageBackendFile/StorageBackendFile.cpp index 54d74ad..7c952bd 100644 --- a/src/modules/StorageBackendFile/StorageBackendFile.cpp +++ b/src/modules/StorageBackendFile/StorageBackendFile.cpp @@ -79,12 +79,15 @@ std::set<std::string> StorageBackendFile::listTypes() throw (Core::Exception) { std::set<std::string> ret; - for(boost::filesystem::directory_iterator it(storageRoot); it != boost::filesystem::directory_iterator(); ++it) { - boost::filesystem::path path = *it; + try { + for(boost::filesystem::directory_iterator it(storageRoot); it != boost::filesystem::directory_iterator(); ++it) { + boost::filesystem::path path = *it; - if(boost::filesystem::is_directory(path)) - ret.insert(path.filename()); + if(boost::filesystem::is_directory(path)) + ret.insert(path.filename()); + } } + catch(...) {} // Don't throw if we can't iterate over the dirs return ret; } @@ -100,12 +103,15 @@ std::set<std::string> StorageBackendFile::list(const std::string &type) throw (C boost::filesystem::path path(storageRoot); path /= type; - for(boost::filesystem::directory_iterator it(path); it != boost::filesystem::directory_iterator(); ++it) { - boost::filesystem::path filePath = *it; + try { + for(boost::filesystem::directory_iterator it(path); it != boost::filesystem::directory_iterator(); ++it) { + boost::filesystem::path filePath = *it; - if(boost::filesystem::is_regular_file(filePath) && filePath.extension() == ".xml") - ret.insert(filePath.replace_extension().filename()); + if(boost::filesystem::is_regular_file(filePath) && filePath.extension() == ".xml") + ret.insert(filePath.replace_extension().filename()); + } } + catch(...) {} // Don't throw if we can't iterate over the dirs return ret; } |