From 5daaf23980a8ac69fcaf12faec9194a4ff887b55 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 15 Nov 2024 12:24:20 +0100 Subject: [PATCH] Core: Add method ProjectFile::containsFile --- src/App/ProjectFile.cpp | 7 +++++++ src/App/ProjectFile.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/App/ProjectFile.cpp b/src/App/ProjectFile.cpp index b87fa0394f..28269368bc 100644 --- a/src/App/ProjectFile.cpp +++ b/src/App/ProjectFile.cpp @@ -461,6 +461,13 @@ void ProjectFile::findFiles(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, } } +bool ProjectFile::containsFile(const std::string& name) const +{ + zipios::ZipFile project(stdFile); + auto entry = project.getEntry(name); + return entry != nullptr; +} + std::list ProjectFile::getInputFiles(const std::string& name) const { // diff --git a/src/App/ProjectFile.h b/src/App/ProjectFile.h index f2423f7d08..597ccc72c8 100644 --- a/src/App/ProjectFile.h +++ b/src/App/ProjectFile.h @@ -148,6 +148,11 @@ public: * @see getInputFiles(). */ std::list getPropertyFiles(const std::string& name) const; + /** + * If the project file contains the file \a name true is returned and + * false otherwise + */ + bool containsFile(const std::string& name) const; /** * Retrieves a list of input file names referenced to the given object name. * This method does the same as @ref getPropertyFiles() unless that it only