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 #include +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; }