[139616] trunk/dports/science/collada-dom
mmoll at macports.org
mmoll at macports.org
Fri Aug 21 10:38:47 PDT 2015
Revision: 139616
https://trac.macports.org/changeset/139616
Author: mmoll at macports.org
Date: 2015-08-21 10:38:47 -0700 (Fri, 21 Aug 2015)
Log Message:
-----------
science/collada-dom: add patch for decompressing zae files
Modified Paths:
--------------
trunk/dports/science/collada-dom/Portfile
Added Paths:
-----------
trunk/dports/science/collada-dom/files/patch-daeZAEUncompressHandler.cpp.diff
Modified: trunk/dports/science/collada-dom/Portfile
===================================================================
--- trunk/dports/science/collada-dom/Portfile 2015-08-21 16:52:48 UTC (rev 139615)
+++ trunk/dports/science/collada-dom/Portfile 2015-08-21 17:38:47 UTC (rev 139616)
@@ -6,6 +6,7 @@
name collada-dom
version 2.4.0
+revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories science devel
maintainers nomaintainer
@@ -26,7 +27,8 @@
extract.suffix .tgz
-patchfiles patch-CMakeLists.txt.diff
+patchfiles patch-CMakeLists.txt.diff \
+ patch-daeZAEUncompressHandler.cpp.diff
depends_lib \
port:boost \
Added: trunk/dports/science/collada-dom/files/patch-daeZAEUncompressHandler.cpp.diff
===================================================================
--- trunk/dports/science/collada-dom/files/patch-daeZAEUncompressHandler.cpp.diff (rev 0)
+++ trunk/dports/science/collada-dom/files/patch-daeZAEUncompressHandler.cpp.diff 2015-08-21 17:38:47 UTC (rev 139616)
@@ -0,0 +1,74 @@
+diff -ru dom/src/dae/daeZAEUncompressHandler.cpp dom/src/dae/daeZAEUncompressHandler.cpp
+--- dom/src/dae/daeZAEUncompressHandler.cpp 2011-04-29 06:17:47.000000000 -0700
++++ dom/src/dae/daeZAEUncompressHandler.cpp 2012-12-31 16:37:37.000000000 -0800
+@@ -4,6 +4,8 @@
+ #include <dae/daeErrorHandler.h>
+ #include <dae/daeZAEUncompressHandler.h>
+
++namespace fs = boost::filesystem;
++
+ //-----------------------------------------------------------------
+ const std::string daeZAEUncompressHandler::MANIFEST_FILE_NAME("manifest.xml");
+ const std::string daeZAEUncompressHandler::MANIFEST_FILE_ROOT_ELEMENT_NAME("dae_root");
+@@ -23,8 +26,7 @@
+
+ mValidZipFile = mZipFile != NULL;
+
+- mTmpDir = cdom::getSafeTmpDir() + cdom::getRandomFileName() +
+- cdom::getFileSeparator() + mZipFileURI.pathFile() + cdom::getFileSeparator();
++ mTmpDir = (fs::temp_directory_path() / fs::unique_path()).string();
+ }
+
+ //-----------------------------------------------------------------
+@@ -70,10 +73,12 @@
+ //-----------------------------------------------------------------
+ bool daeZAEUncompressHandler::retrieveRootURIFromManifest(const std::string& tmpDir)
+ {
++ std::string manifest_path = (fs::path(tmpDir) / MANIFEST_FILE_NAME).string();
++
+ // extract via libxml.
+ bool error = false;
+ xmlTextReaderPtr xmlReader = xmlReaderForFile(
+- (tmpDir + MANIFEST_FILE_NAME).c_str(),
++ manifest_path.c_str(),
+ NULL,
+ 0
+ );
+@@ -94,7 +99,7 @@
+ xmlTextReaderRead(xmlReader);
+
+ cdom::trimWhitespaces(rootFilePath);
+- mRootFilePath = cdom::nativePathToUri(tmpDir + rootFilePath);
++ mRootFilePath = (fs::path(tmpDir) / rootFilePath).string();
+ }
+ else
+ {
+@@ -192,7 +197,7 @@
+ {
+ if ( currentFileName[ strlen(currentFileName)-1 ] == '/')
+ {
+- if (!boost::filesystem::create_directories(destDir + currentFileName))
++ if (!boost::filesystem::create_directories(fs::path(destDir) / currentFileName))
+ {
+ daeErrorHandler::get()->handleError("Error creating dir from zip archive in daeZAEUncompressHandler::extractFile\n");
+ error = true;
+@@ -206,8 +211,8 @@
+ char* buffer = 0;
+ int readBytes = 1;
+ buffer = new char[ BUFFER_SIZE ];
+- std::string currentOutFilePath(destDir + std::string(currentFileName));
+- std::ofstream outFile(currentOutFilePath.c_str(), std::ios::binary);
++ fs::path currentOutFilePath= fs::path(destDir) / std::string(currentFileName);
++ std::ofstream outFile(currentOutFilePath.string().c_str(), std::ios::binary);
+
+ while (readBytes > 0)
+ {
+@@ -226,7 +231,7 @@
+ }
+ else
+ {
+- if (!checkAndExtractInternalArchive(currentOutFilePath))
++ if (!checkAndExtractInternalArchive(currentOutFilePath.string()))
+ {
+ error = true;
+ }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150821/f34ac481/attachment.html>
More information about the macports-changes
mailing list