Mercurial > hg > orthanc
diff Core/FileStorage.cpp @ 147:7e8b68dd6ace
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Oct 2012 18:02:23 +0200 |
parents | e7e19f042eb5 |
children | 0fadb04728ba |
line wrap: on
line diff
--- a/Core/FileStorage.cpp Thu Oct 11 17:50:50 2012 +0200 +++ b/Core/FileStorage.cpp Thu Oct 11 18:02:23 2012 +0200 @@ -278,35 +278,37 @@ namespace fs = boost::filesystem; fs::path p = GetPath(uuid); - fs::remove(p); + + try + { + fs::remove(p); + } + catch (fs::filesystem_error) + { + // Ignore the error + } // Remove the two parent directories, ignoring the error code if // these directories are not empty -#if BOOST_HAS_FILESYSTEM_V3 == 1 - boost::system::error_code err; - fs::remove(p.parent_path(), err); - fs::remove(p.parent_path().parent_path(), err); -#else - fs::remove(p.parent_path()); - fs::remove(p.parent_path().parent_path()); -#endif - } - - void FileStorage::UncheckedRemove(const std::string& uuid) - { try { - Remove(uuid); +#if BOOST_HAS_FILESYSTEM_V3 == 1 + boost::system::error_code err; + fs::remove(p.parent_path(), err); + fs::remove(p.parent_path().parent_path(), err); +#else + fs::remove(p.parent_path()); + fs::remove(p.parent_path().parent_path()); +#endif } - catch (boost::filesystem::filesystem_error) + catch (fs::filesystem_error) { // Ignore the error } } - uintmax_t FileStorage::GetCapacity() const { return boost::filesystem::space(root_).capacity;