diff options
author | Valtteri Koskivuori <vkoskiv@gmail.com> | 2021-05-24 20:14:11 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-24 18:55:56 +0100 |
commit | cb8d0c8d0d139b0212a91355972000ba79392960 (patch) | |
tree | 19da743d3fe785932435cbaf1b3ae386a2a6eb57 /Userland/Utilities/file.cpp | |
parent | 9a1ac662f19fe4163e13881407e05a64fd4aed8f (diff) | |
download | serenity-cb8d0c8d0d139b0212a91355972000ba79392960.zip |
LibCore+Userland: Add 13 more detectable file types
This patch adds 13 new detectable file formats, which are as follows in
alphabetical order:
.blend, .isz, ext* filesystem, Lua bytecode, Matroska container, NES
ROM, .pdf, qcow image, .rtf, WebAssembly bytecode, Windows 3.1X/95
compressed archive and raw zlib stream
Some are a tad esoteric, but the more file types we detect, the more
useful this utility becomes! :^)
Diffstat (limited to 'Userland/Utilities/file.cpp')
-rw-r--r-- | Userland/Utilities/file.cpp | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/Userland/Utilities/file.cpp b/Userland/Utilities/file.cpp index f0064d17aa..edfd9f14e8 100644 --- a/Userland/Utilities/file.cpp +++ b/Userland/Utilities/file.cpp @@ -52,24 +52,37 @@ static Optional<String> gzip_details(String description, const String& path) return String::formatted("{}, {}", description, gzip_details.value()); } -#define ENUMERATE_MIME_TYPE_DESCRIPTIONS \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("application/gzip", "gzip compressed data", gzip_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("application/javascript", "JavaScript source", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("application/json", "JSON data", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("application/tar", "tape archive", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("application/x-7z-compressed", "7-Zip archive", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("audio/midi", "MIDI sound", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/flac", "FLAC audio", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/iso-9660", "ISO 9660 CD/DVD image", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/sqlite", "sqlite database", description_only) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/bmp", "BMP image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/gif", "GIF image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/jpeg", "JPEG image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/png", "PNG image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/x-portable-bitmap", "PBM image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/x-portable-graymap", "PGM image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("image/x-portable-pixmap", "PPM image data", image_details) \ - __ENUMERATE_MIME_TYPE_DESCRIPTION("text/markdown", "Markdown document", description_only) \ +#define ENUMERATE_MIME_TYPE_DESCRIPTIONS \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/gzip", "gzip compressed data", gzip_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/javascript", "JavaScript source", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/json", "JSON data", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/pdf", "PDF document", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/rtf", "Rich text file", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/tar", "tape archive", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/wasm", "WebAssembly bytecode", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("application/x-7z-compressed", "7-Zip archive", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("audio/midi", "MIDI sound", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/blender", "Blender project file", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/ext", "ext filesystem", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/flac", "FLAC audio", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/iso-9660", "ISO 9660 CD/DVD image", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/isz", "Compressed ISO image", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/lua-bytecode", "Lua bytecode", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/matroska", "Matroska container", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/nes-rom", "Nintendo Entertainment System ROM", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/qcow", "qcow file", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/raw-zlib", "raw zlib stream", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/sqlite", "sqlite database", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/win-31x-compressed", "Windows 3.1X compressed file", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("extra/win-95-compressed", "Windows 95 compressed file", description_only) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/bmp", "BMP image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/gif", "GIF image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/jpeg", "JPEG image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/png", "PNG image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/x-portable-bitmap", "PBM image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/x-portable-graymap", "PGM image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("image/x-portable-pixmap", "PPM image data", image_details) \ + __ENUMERATE_MIME_TYPE_DESCRIPTION("text/markdown", "Markdown document", description_only) \ __ENUMERATE_MIME_TYPE_DESCRIPTION("text/x-shellscript", "POSIX shell script text executable", description_only) static Optional<String> get_description_from_mime_type(const String& mime, const String& path) |