diff options
Diffstat (limited to 'data/generate.rb')
-rwxr-xr-x | data/generate.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/data/generate.rb b/data/generate.rb new file mode 100755 index 00000000..c6038b3a --- /dev/null +++ b/data/generate.rb @@ -0,0 +1,21 @@ +#!/usr/bin/ruby + +file = File.read(ARGV[0] || "mime.types") + +table = {} +for l in file.lines + next if l[0] == ?# + next unless l.size > 3 + next unless l.include? ?\t + + left, *exts = l.split(/\s+/) +# print exts.inspect + for ext in exts + table[ext] = left + end +end + +File.open('mime.dat', 'w') do |f| + f.write Marshal.dump(table) +end + |