18 #include "Poco/Zip/Decompress.h"
19 #include "Poco/Path.h"
20 #include "Poco/File.h"
28 #include <Poco/Exception.h>
31 #include "mitkIGTException.h"
32 #include "mitkIGTIOException.h"
48 if (myFile.exists()) myFile.remove();
52 MITK_ERROR <<
"Can't remove temp directory " << m_tempDirectory <<
"!";
59 decomressFiles(filename,m_tempDirectory);
65 for (i=0; cont==
true; i++)
67 std::string fileName = m_tempDirectory + Poco::Path::separator() +
"NavigationTool" + convertIntToString(i) +
".tool";
70 if (readTool.IsNull()) cont =
false;
71 else returnValue->AddTool(readTool);
73 std::remove(fileName.c_str());
78 m_ErrorMessage =
"Error: did not find any tool. \n Is this a tool storage file?";
87 std::stringstream out;
95 std::ifstream file( filename.c_str(), std::ios::binary );
98 m_ErrorMessage =
"Cannot open '" + filename +
"' for reading";
104 Poco::Zip::Decompress unzipper( file, Poco::Path( path ) );
105 unzipper.decompressAllFiles();
109 catch(Poco::IllegalStateException e)
111 m_ErrorMessage =
"Error: wrong file format! \n (please only load tool storage files)";
itk::SmartPointer< Self > Pointer
static std::string GetTempPath()
An object of this class represents an exception of the MITK-IGT module.
mitk::DataStorage::Pointer m_DataStorage
static const std::string filename
static std::string CreateTemporaryDirectory(const std::string &templateName="XXXXXX", std::string path=std::string())
#define mitkThrowException(classname)