about summary refs log tree commit diff stats
path: root/data/generate.rb
blob: c6038b3a8b577929c36eddcfb290d93af802a35f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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