about summary refs log tree commit diff stats
path: root/data/types.rb
blob: 8719f07c284ceb7de98693405926c051e61aa131 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Directory::Entry
	INTERPRETED_LANGUAGES = %w[haskell perl python ruby sh]
	MOVIE_EXTENSIONS = %w[avi mpg mpeg mp4 mp5 ogv ogm wmv mkv flv fid vob div divx]

	def get_handler
		## directories or sockets don't have any handler
		use.no_handler if dir? or socket?

		case @basename
		when 'Makefile'
			log "i use make"
			use.make
		when /^[Rr]akefile(.rb)?$/
			use.rake
		end

		case @mimetype
		when /^video/
			use.mplayer_detached

		when /^audio/
			use.mplayer

		when "application/pdf"
			use.evince

		when /^image/
			use.feh

		when /^(text|application)\/x-(#{INTERPRETED_LANGUAGES.join('|')})$/
			use.interpreted_language

		when 'text/x-java'
			use.javac

		when 'application/java-vm'
			use.java

		when 'text/html', 'application/x-shockwave-flash'
			use.firefox

		end

		## second, look at the extension
		case @ext
		when 'swc', 'smc'
			use.zsnes

		end

		## otherwise use vi
		use.vi
	end
end