DETECTION: Don't call appendComponent when it's not needed

This commit is contained in:
Le Philousophe
2025-08-07 19:50:21 +02:00
parent 22bb7faa3d
commit 0d549d86f9
+2 -2
View File
@@ -442,7 +442,7 @@ void AdvancedMetaEngineDetectionBase::composeFileHashMap(FileMap &allFiles, cons
for (const auto &file : fslist) {
Common::String efname = Common::punycode_encodefilename(file.getName());
Common::Path tstr = ((_flags & kADFlagMatchFullPaths) ? parentName : Common::Path()).appendComponent(efname);
Common::Path tstr = (_flags & kADFlagMatchFullPaths) ? parentName.appendComponent(efname) : Common::Path(efname, Common::Path::kNoSeparator);
if (file.isDirectory()) {
if (!_globsMap.contains(efname))
@@ -459,7 +459,7 @@ void AdvancedMetaEngineDetectionBase::composeFileHashMap(FileMap &allFiles, cons
// Strip any trailing dot
if (efname.lastChar() == '.') {
efname.deleteLastChar();
tstr = ((_flags & kADFlagMatchFullPaths) ? parentName : Common::Path()).appendComponent(efname);
tstr = (_flags & kADFlagMatchFullPaths) ? parentName.appendComponent(efname) : Common::Path(efname, Common::Path::kNoSeparator);
}
debugC(9, kDebugGlobalDetection, "$$ ['%s'] ['%s'] in '%s", tstr.toString().c_str(), efname.c_str(), firstPathComponents(fslist.front().getPath().toString(), '/').c_str());