@@ -413,7 +413,7 @@ bool PackFile::extractAll(const std::string& outputDir, bool createUnderPackFile
413413	}
414414	bool  noneFailed = true ;
415415	this ->runForAllEntries ([this , &outputDirPath, &noneFailed](const  std::string& path, const  Entry& entry) {
416- 		std::string entryPath = path;
416+ 		std::string entryPath = path;  //  NOLINT(*-unnecessary-copy-initialization) 
417417#ifdef  _WIN32
418418		::fixFilePathForWindows (entryPath);
419419#endif 
@@ -520,6 +520,34 @@ void PackFile::runForAllEntries(const EntryCallback& operation, bool includeUnba
520520	}
521521}
522522
523+ void  PackFile::runForAllEntries (const  std::string& parentDir, const  EntryCallback& operation, bool  recursive, bool  includeUnbaked) const  {
524+ 	auto  dir = this ->cleanEntryPath (parentDir) + ' /' 
525+ 
526+ 	std::string key;
527+ 	for  (auto  [entry, end] = this ->entries .equal_prefix_range (dir); entry != end; ++entry) {
528+ 		entry.key (key);
529+ 		if  (!recursive) {
530+ 			auto  keyView = std::string_view{key}.substr (dir.length ());
531+ 			if  (std::find (keyView.begin (), keyView.end (), ' /' end ()) {
532+ 				continue ;
533+ 			}
534+ 		}
535+ 		operation (key, entry.value ());
536+ 	}
537+ 	if  (includeUnbaked) {
538+ 		for  (auto  [entry, end] = this ->unbakedEntries .equal_prefix_range (dir); entry != end; ++entry) {
539+ 			entry.key (key);
540+ 			if  (!recursive) {
541+ 				auto  keyView = std::string_view{key}.substr (dir.length ());
542+ 				if  (std::find (keyView.begin (), keyView.end (), ' /' end ()) {
543+ 					continue ;
544+ 				}
545+ 			}
546+ 			operation (key, entry.value ());
547+ 		}
548+ 	}
549+ }
550+ 
523551void  PackFile::runForAllEntriesInternal (const  std::function<void (const  std::string&, Entry&)>& operation, bool includeUnbaked) {
524552	std::string key;
525553	for  (auto  entry = this ->entries .begin (); entry != this ->entries .end (); ++entry) {
@@ -534,6 +562,34 @@ void PackFile::runForAllEntriesInternal(const std::function<void(const std::stri
534562	}
535563}
536564
565+ void  PackFile::runForAllEntriesInternal (const  std::string& parentDir, const  std::function<void (const  std::string&, Entry&)>& operation, bool recursive, bool includeUnbaked) {
566+ 	auto  dir = this ->cleanEntryPath (parentDir) + ' /' 
567+ 
568+ 	std::string key;
569+ 	for  (auto  [entry, end] = this ->entries .equal_prefix_range (dir); entry != end; ++entry) {
570+ 		entry.key (key);
571+ 		if  (!recursive) {
572+ 			auto  keyView = std::string_view{key}.substr (dir.length ());
573+ 			if  (std::find (keyView.begin (), keyView.end (), ' /' end ()) {
574+ 				continue ;
575+ 			}
576+ 		}
577+ 		operation (key, entry.value ());
578+ 	}
579+ 	if  (includeUnbaked) {
580+ 		for  (auto  [entry, end] = this ->unbakedEntries .equal_prefix_range (dir); entry != end; ++entry) {
581+ 			entry.key (key);
582+ 			if  (!recursive) {
583+ 				auto  keyView = std::string_view{key}.substr (dir.length ());
584+ 				if  (std::find (keyView.begin (), keyView.end (), ' /' end ()) {
585+ 					continue ;
586+ 				}
587+ 			}
588+ 			operation (key, entry.value ());
589+ 		}
590+ 	}
591+ }
592+ 
537593std::string_view PackFile::getFilepath () const  {
538594	return  this ->fullFilePath ;
539595}
0 commit comments