Flag compressed archive extensions as binary files (SpartanJ/ecode#589).

This commit is contained in:
Martín Lucas Golini
2025-07-14 23:59:59 -03:00
parent 588612dbca
commit 257ff4b065
2 changed files with 15 additions and 1 deletions

View File

@@ -22,7 +22,19 @@ bool PathHelper::isDocumentExtension( std::string_view ext ) {
}
bool PathHelper::isOpenExternalExtension( std::string_view ext ) {
return isVideoExtension( ext ) || isDocumentExtension( ext );
return isVideoExtension( ext ) || isDocumentExtension( ext ) ||
isCompressedArchiveExtension( ext );
}
bool PathHelper::isCompressedArchiveExtension( std::string_view ext ) {
static constexpr std::array<std::string_view, 29> extensions = {
"zip", "rar", "7z", "tar", "gz", "bz2", "xz", "z", "arj", "cab",
"iso", "lzh", "lzma", "tgz", "tbz2", "txz", "zst", "ace", "arc", "cpio",
"deb", "dmg", "lrz", "lz", "lzo", "rpm", "shar", "wim", "zipx" };
for ( const auto& cext : extensions )
if ( String::iequals( ext, cext ) )
return true;
return false;
}
} // namespace ecode