MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / findFolderOfFileInZip

Method findFolderOfFileInZip

launcher/MMCZip.cpp:232–253  ·  view source on GitHub ↗

ours

Source from the content-addressed store, hash-verified

230
231// ours
232std::pair<QString, QString> MMCZip::findFolderOfFileInZip(QuaZip * zip, QSet<const QString> what, const QString &root)
233{
234 std::deque<QString> pathsToTraverse;
235 pathsToTraverse.push_back(root);
236 while (!pathsToTraverse.empty())
237 {
238 QString currentPath = pathsToTraverse.front();
239 pathsToTraverse.pop_front();
240 QuaZipDir rootDir(zip, currentPath);
241
242 for(auto fileName: rootDir.entryList(QDir::Files))
243 {
244 if (what.contains(fileName))
245 return {currentPath, fileName};
246 }
247 for(auto fileName: rootDir.entryList(QDir::Dirs))
248 {
249 pathsToTraverse.push_back(rootDir.path() + fileName);
250 }
251 }
252 return {QString(), QString()};
253}
254
255// ours
256bool MMCZip::findFilesInZip(QuaZip * zip, const QString & what, QStringList & result, const QString &root)

Callers

nothing calls this directly

Calls 4

QStringClass · 0.85
pathMethod · 0.80
emptyMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected