我正在尝试使用 Gio::ContentType.get_icon 在 Ruby 中获取与 mime 类型相关联的图标,但它失败并出现错误:
main.rb:11:in `get_icon': no implicit conversion of Module into String (TypeError)
from main.rb:11:in `<main>'
代码:
#!/usr/bin/env ruby
require "gtk3"
require "glib2"
require "gio2"
mime_type = "image/jpeg"
icon = Gio::ContentType.get_icon(mime_type)
我真的不明白为什么会发生这种情况或我做错了什么......
任何帮助,将不胜感激。抱歉英语不好。