changeset 1278:7aa0630a958e

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Jan 2015 14:17:07 +0100
parents 46bca019587e
children 7f3a65e84d4b
files Core/Compression/ZipWriter.cpp
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Compression/ZipWriter.cpp	Mon Jan 26 15:22:14 2015 +0100
+++ b/Core/Compression/ZipWriter.cpp	Tue Jan 27 14:17:07 2015 +0100
@@ -38,10 +38,11 @@
 
 #include "ZipWriter.h"
 
-#include "../../Resources/ThirdParty/minizip/zip.h"
+#include <limits>
+#include <boost/filesystem.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
-#include <limits>
 
+#include "../../Resources/ThirdParty/minizip/zip.h"
 #include "../OrthancException.h"
 
 
@@ -126,7 +127,12 @@
 
     hasFileInZip_ = false;
 
-    int mode = (append_ ? APPEND_STATUS_ADDINZIP : APPEND_STATUS_CREATE);
+    int mode = APPEND_STATUS_CREATE;
+    if (append_ && 
+        boost::filesystem::exists(path_))
+    {
+      mode = APPEND_STATUS_ADDINZIP;
+    }
 
     if (isZip64_)
     {