103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/unixcmd/aux.rb', line 103
def self.get_icon_path(filepath)
icons_path = Pathname.new '/usr/share/icons/gnome/16x16'
return icons_path + Pathname.new('places/folder.png') if filepath.directory?
icon_names = MIME::Types.get_icon_names(filepath.to_s)
return icons_path + Pathname.new('mimetypes/text-x-generic.png') if icon_names == nil
icon_names.each do |icon|
icon_path = icons_path + Pathname.new('mimetypes') + Pathname.new(icon.to_s + '.png')
return icon_path.to_s if icon_path.exist?
end
icons_path + Pathname.new('mimetypes/text-x-generic.png')
end
|