[svn] Find self-extracting archives by their file magic only, not extension/mimetype. trunk

Wed, 06 Feb 2008 19:38:26 -0500

author
brett
date
Wed, 06 Feb 2008 19:38:26 -0500
branch
trunk
changeset 59
7a0aafe2fe87
parent 58
16506464d57b
child 60
6d7246a56b00

[svn] Find self-extracting archives by their file magic only, not extension/mimetype.

The problem with using extensions/mimetypes for this is that it net way too
many false positives. Files ending in .com, .bat, etc. would cause the
user to be prompted for recursive extraction. This makes that problem go
away, and it means that error messages when the user tries to extract a
non-archive .exe will probably be more useful, too.

scripts/dtrx file | annotate | diff | comparison | revisions
--- a/scripts/dtrx	Sun Jan 20 15:32:02 2008 -0500
+++ b/scripts/dtrx	Wed Feb 06 19:38:26 2008 -0500
@@ -694,7 +694,7 @@
 
     mimetype_map = {}
     for mapping in (('tar', 'x-tar'),
-                    ('zip', 'x-msdos-program', 'zip'),
+                    ('zip', 'zip'),
                     ('deb', 'x-debian-package'),
                     ('rpm', 'x-redhat-package-manager', 'x-rpm'),
                     ('cpio', 'x-cpio'),
@@ -710,7 +710,7 @@
     for mapping in (('deb', 'Debian binary package'),
                     ('cpio', 'cpio archive'),
                     ('tar', 'POSIX tar archive'),
-                    ('zip', 'Zip archive'),
+                    ('zip', '(Zip|ZIP self-extracting) archive'),
                     ('rpm', 'RPM'),
                     ('7z', '7-zip archive'),
                     ('cab', 'Microsoft Cabinet archive')):
@@ -727,7 +727,7 @@
     for mapping in (('tar', 'bzip2', 'tar.bz2'),
                     ('tar', 'gzip', 'tar.gz', 'tgz'),
                     ('tar', None, 'tar'),
-                    ('zip', None, 'zip', 'exe'),
+                    ('zip', None, 'zip'),
                     ('deb', None, 'deb'),
                     ('rpm', None, 'rpm'),
                     ('cpio', None, 'cpio'),

mercurial