From ed6322630fd3bead1b8109ebaa376cab7100f461 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 7 Sep 2007 10:50:13 +0000 Subject: [PATCH] From Daniel Sjolie, "I patched the zip plugin to make use of my favorite zip/pack-application for windows if it is installed in the standard location..." --- src/osgPlugins/zip/ReaderWriterZIP.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/zip/ReaderWriterZIP.cpp b/src/osgPlugins/zip/ReaderWriterZIP.cpp index 0dc5b1eb0..d4fa695be 100644 --- a/src/osgPlugins/zip/ReaderWriterZIP.cpp +++ b/src/osgPlugins/zip/ReaderWriterZIP.cpp @@ -55,11 +55,25 @@ class ReaderWriterZIP : public osgDB::ReaderWriter mkdir(dirname); // Using unzip.exe from http://www.info-zip.org/pub/infozip/UnZip.html // unzip.exe must be in your path. (PATH environment variable). - sprintf( command, - "unzip -o -qq \"%s\" -d \"%s\"", - fileName.c_str(), dirname); + + // OR - WinRAR + + // Checking for WinRAR + std::string winrar = std::string( getenv( "ProgramFiles" ) ) + "/WinRAR/winrar.exe"; + if ( osgDB::fileExists(winrar) ) { + sprintf( command, + "%s x -o+ \"%s\" \"%s\"", winrar.c_str(), + fileName.c_str(), dirname); + } else { + sprintf( command, + "unzip -o -qq \"%s\" -d \"%s\"", + fileName.c_str(), dirname); + } + osg::notify(osg::NOTICE)<<"Running command '"<