changeset 147:7e8b68dd6ace

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Oct 2012 18:02:23 +0200
parents c7f1cea08f6f
children 0fadb04728ba
files CMakeLists.txt Core/FileStorage.cpp Core/FileStorage.h NEWS OrthancServer/ServerIndex.cpp Resources/CMake/SQLiteConfiguration.cmake
diffstat 6 files changed, 25 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Oct 11 17:50:50 2012 +0200
+++ b/CMakeLists.txt	Thu Oct 11 18:02:23 2012 +0200
@@ -17,12 +17,14 @@
 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp (only for Debian sid)")
 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log")
 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)")
+SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
 SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)")
 SET(DEBIAN_USE_STATIC_GOOGLE_TEST OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
 
 mark_as_advanced(USE_DYNAMIC_JSONCPP)
 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG)
 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST)
+mark_as_advanced(USE_DYNAMIC_SQLITE)
 mark_as_advanced(DEBIAN_FORCE_HARDENING)
 mark_as_advanced(DEBIAN_USE_STATIC_GOOGLE_TEST)
 
--- 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;
--- a/Core/FileStorage.h	Thu Oct 11 17:50:50 2012 +0200
+++ b/Core/FileStorage.h	Thu Oct 11 18:02:23 2012 +0200
@@ -82,8 +82,6 @@
 
     void Remove(const std::string& uuid);
 
-    void UncheckedRemove(const std::string& uuid);
-
     uintmax_t GetCapacity() const;
 
     uintmax_t GetAvailableSpace() const;
--- a/NEWS	Thu Oct 11 17:50:50 2012 +0200
+++ b/NEWS	Thu Oct 11 18:02:23 2012 +0200
@@ -2,7 +2,9 @@
 ===============================
 
 * Help on the command line
+* Improved logging
 * Possibility of dynamic linking against jsoncpp, sqlite, boost and dmctk
+* Fix some bugs
 
 
 Version 0.2.2 (2012/10/04)
--- a/OrthancServer/ServerIndex.cpp	Thu Oct 11 17:50:50 2012 +0200
+++ b/OrthancServer/ServerIndex.cpp	Thu Oct 11 18:02:23 2012 +0200
@@ -607,8 +607,8 @@
 
     if (status != StoreStatus_Success)
     {
-      storage.UncheckedRemove(fileUuid);
-      storage.UncheckedRemove(jsonUuid);
+      storage.Remove(fileUuid);
+      storage.Remove(jsonUuid);
     }
 
     switch (status)
--- a/Resources/CMake/SQLiteConfiguration.cmake	Thu Oct 11 17:50:50 2012 +0200
+++ b/Resources/CMake/SQLiteConfiguration.cmake	Thu Oct 11 18:02:23 2012 +0200
@@ -1,4 +1,4 @@
-if (${STATIC_BUILD})
+if (STATIC_BUILD OR NOT USE_DYNAMIC_SQLITE)
   SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300)
   DownloadPackage("http://www.sqlite.org/sqlite-amalgamation-3071300.zip" "${SQLITE_SOURCES_DIR}" "" "")