diff --git a/src/App/ProjectFile.cpp b/src/App/ProjectFile.cpp index 601969e02f..cf56233bc5 100644 --- a/src/App/ProjectFile.cpp +++ b/src/App/ProjectFile.cpp @@ -66,6 +66,26 @@ using namespace App; namespace { + +class ZipTools +{ +public: + static std::unique_ptr open(const std::string& file) + { + std::unique_ptr project; + try { + project = std::make_unique(file); + if (!project->isValid()) { + project.reset(); + } + } + catch (const std::exception&) { + } + + return project; + } +}; + class DocumentMetadata { public: @@ -212,11 +232,12 @@ bool ProjectFile::loadDocument() return true; // already loaded } - zipios::ZipFile project(stdFile); - if (!project.isValid()) { + auto project = ZipTools::open(stdFile); + if (!project) { return false; } - std::unique_ptr str(project.getInputStream("Document.xml")); + + std::unique_ptr str(project->getInputStream("Document.xml")); if (str) { std::unique_ptr parser(new XercesDOMParser); parser->setValidationScheme(XercesDOMParser::Val_Auto);