diff --git a/DataSpec/DNACommon/PAK.cpp b/DataSpec/DNACommon/PAK.cpp index cd12d62f3..30b3d2fc2 100644 --- a/DataSpec/DNACommon/PAK.cpp +++ b/DataSpec/DNACommon/PAK.cpp @@ -523,7 +523,7 @@ bool PAKRouter::extractResources(const BRIDGETYPE& pakBridge, bool f if (extractor.func_a) /* Doesn't need PAKRouter access */ { - if (force || working.isNone()) + if (force || !extractor.IsFullyExtracted(working)) { PAKEntryReadStream s = item->beginReadStream(*node); extractor.func_a(s, working); @@ -531,7 +531,7 @@ bool PAKRouter::extractResources(const BRIDGETYPE& pakBridge, bool f } else if (extractor.func_b) /* Needs PAKRouter access */ { - if (force || working.isNone()) + if (force || !extractor.IsFullyExtracted(working)) { PAKEntryReadStream s = item->beginReadStream(*node); extractor.func_b(m_dataSpec, s, working, *this, *item, force, btok, diff --git a/DataSpec/DNACommon/PAK.hpp b/DataSpec/DNACommon/PAK.hpp index ad64ed971..2145f1e05 100644 --- a/DataSpec/DNACommon/PAK.hpp +++ b/DataSpec/DNACommon/PAK.hpp @@ -105,6 +105,25 @@ struct ResExtractor std::function&, typename PAKBRIDGE::PAKType::Entry&)> nfunc={}) : func_b(std::move(func)), fileExts(std::move(fileExtsIn)), weight(weightin), func_name(std::move(nfunc)) {} + + bool IsFullyExtracted(const hecl::ProjectPath& path) const + { + hecl::ProjectPath::Type tp = path.getPathType(); + if (tp == hecl::ProjectPath::Type::None) + return false; + else if (tp == hecl::ProjectPath::Type::Glob) + { + for (int i=0 ; i<6 ; ++i) + { + if (!fileExts[i]) + break; + hecl::ProjectPath withExt = path.getWithExtension(fileExts[i], true); + if (withExt.isNone()) + return false; + } + } + return true; + } }; /** Level hierarchy representation */