Add archives.h
This commit is contained in:
parent
21c7186b81
commit
d8cb560f68
51
main.cpp
51
main.cpp
@ -7,7 +7,8 @@
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
#ifndef NO_MIME
|
||||
#include <magic.h>
|
||||
#include <magic.h> // Did you remember to run ./configure?
|
||||
#include "archives.h" // Run make nomime
|
||||
#endif
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -60,53 +61,10 @@ bool starts_with(const std::string& prefix, const std::string& string) {
|
||||
return string.rfind(prefix, 0) == 0;
|
||||
}
|
||||
|
||||
#ifndef NO_MIME
|
||||
bool is_archive(const std::string& mime_type)
|
||||
{
|
||||
const std::string archives[] = {
|
||||
"application/x-archive",
|
||||
"application/x-cpio",
|
||||
"application/x-shar",
|
||||
"application/x-iso9660-image",
|
||||
"application/x-sbx",
|
||||
"application/x-tar",
|
||||
"application/x-brotli",
|
||||
"application/x-bzip2",
|
||||
"application/vnd.genozip",
|
||||
"application/gzip",
|
||||
"application/x-lzip",
|
||||
"application/x-lzma",
|
||||
"application/x-lzop",
|
||||
"application/x-snappy-framed",
|
||||
"application/x-xz",
|
||||
"application/x-compress",
|
||||
"application/x-compress",
|
||||
"application/zstd",
|
||||
"application/x-7z-compressed",
|
||||
"application/x-ace-compressed",
|
||||
"application/x-astrotite-afa",
|
||||
"application/x-alz-compressed",
|
||||
"application/vnd.android.package-archive",
|
||||
"application/x-freearc",
|
||||
"application/x-arj",
|
||||
"application/x-b1",
|
||||
"application/vnd.ms-cab-compressed",
|
||||
"application/x-cfs-compressed",
|
||||
"application/x-dar",
|
||||
"application/x-dgc-compressed",
|
||||
"application/x-apple-diskimage",
|
||||
"application/x-gca-compressed",
|
||||
"application/java-archive",
|
||||
"application/x-lzh",
|
||||
"application/x-lzx",
|
||||
"application/x-rar-compressed",
|
||||
"application/x-stuffit",
|
||||
"application/x-stuffitx",
|
||||
"application/x-gtar",
|
||||
"application/x-ms-wim",
|
||||
"application/x-xar",
|
||||
"application/zip",
|
||||
"application/x-zoo"
|
||||
};
|
||||
const std::string archives[] = ARCHIVES;
|
||||
int len = sizeof(archives)/sizeof(archives[0]);
|
||||
|
||||
for(int i = 0; i < len; ++i)
|
||||
@ -118,6 +76,7 @@ bool is_archive(const std::string& mime_type)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string get_name_from_filetype(const enum FileType fs)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user