我在哪里可以找到 mimeapps.list?

我在哪里可以找到 mimeapps.list?

我正在使用 Ubuntu 14.04 安装 Qt 5此链接

但是,我却无法创造Qt-Creator.桌面文件。文档指示“打开文件mimeapps.列表并检查以下行是否存在”。

application/vnd.nokia.qt.qmakeprofile=qtcreator.desktop

但我找不到mimeapps.列表在应用程序文件夹下。

所以,我在哪里找到mimeapps.列表

请帮我。

提前致谢。

答案1

它应该位于以下目录中:

/usr/share/applications/mimeapps.list

如果它不存在,您可以创建它,并将该行放入此文件中:

sudo nano /usr/share/applications/mimeapps.list

您也可以在主目录中创建此文件:

nano ~/.local/share/applications/mimeapps.list

并将此行放入该文件:

application/vnd.nokia.qt.qmakeprofile=qtcreator.desktop

例如我的mimeapps.list文件内容是:

$ cat /usr/share/applications/mimeapps.list
[Default Applications]
application/wps-office.et=/usr/share//applications/wps-office-et.desktop
application/wps-office.ett=/usr/share//applications/wps-office-et.desktop
application/wps-office.xls=/usr/share//applications/wps-office-et.desktop
application/wps-office.xlt=/usr/share//applications/wps-office-et.desktop
application/vnd.ms-excel=/usr/share//applications/wps-office-et.desktop
application/msexcel=/usr/share//applications/wps-office-et.desktop
application/wps-office.xlsx=/usr/share//applications/wps-office-et.desktop
application/wps-office.xltx=/usr/share//applications/wps-office-et.desktop
vnd.ms-excel.sheet.macroenabled.12=/usr/share//applications/wps-office-et.desktop
vnd.ms-excel.template.macroenabled.12=/usr/share//applications/wps-office-et.desktop
application/wps-office.dps=/usr/share//applications/wps-office-wpp.desktop
application/wps-office.dpt=/usr/share//applications/wps-office-wpp.desktop
application/wps-office.ppt=/usr/share//applications/wps-office-wpp.desktop
application/wps-office.pot=/usr/share//applications/wps-office-wpp.desktop
application/vnd.ms-powerpoint=/usr/share//applications/wps-office-wpp.desktop
application/vnd.mspowerpoint=/usr/share//applications/wps-office-wpp.desktop
application/powerpoint=/usr/share//applications/wps-office-wpp.desktop
application/wps-office.pptx=/usr/share//applications/wps-office-wpp.desktop
application/wps-office.potx=/usr/share//applications/wps-office-wpp.desktop
vnd.ms-powerpoint.presentation.macroenabled.12=/usr/share//applications/wps-office-wpp.desktop
vnd.ms-powerpoint.template.macroenabled.12=/usr/share//applications/wps-office-wpp.desktop
application/wps-office.wps=/usr/share//applications/wps-office-wps.desktop
application/wps-office.wpt=/usr/share//applications/wps-office-wps.desktop
application/wps-office.doc=/usr/share//applications/wps-office-wps.desktop
application/wps-office.dot=/usr/share//applications/wps-office-wps.desktop
application/vnd.ms-word=/usr/share//applications/wps-office-wps.desktop
application/msword=/usr/share//applications/wps-office-wps.desktop
application/msword-template=/usr/share//applications/wps-office-wps.desktop
wps-office-doc.png=/usr/share//applications/wps-office-wps.desktop
wps-office-dot.png=/usr/share//applications/wps-office-wps.desktop

有关 MIME 类型默认应用程序的更多信息,请参阅Arch Linux Wiki 中的此链接

答案2

文件mimeapps.list内容和位置由XDG MIME 应用程序协会规范版本 1.0.1指定查找顺序为:

小路 目的
$XDG_CONFIG_HOME/$desktop-mimeapps.list 用户覆盖,特定于桌面(适用于高级用户)
$XDG_CONFIG_HOME/mimeapps.list 用户覆盖(用户配置 GUI 的推荐位置)
$XDG_CONFIG_DIRS/$desktop-mimeapps.list 系统管理员和 ISV 覆盖,桌面专用
$XDG_CONFIG_DIRS/mimeapps.list 系统管理员和 ISV 覆盖
$XDG_DATA_HOME/applications/$desktop-mimeapps.list 为了完整性,已弃用,特定于桌面
$XDG_DATA_HOME/applications/mimeapps.list 为了兼容性,已弃用
$XDG_DATA_DIRS/applications/$desktop-mimeapps.list 发行版提供的默认值,特定于桌面的
$XDG_DATA_DIRS/applications/mimeapps.list 分配提供的默认值

其中$desktop是小写值$XDG_CURRENT_DESKTOP,它与其他$XDG_环境变量一起由XDG 基础目录规范假设 GNOME 桌面环境中的默认值,查找顺序为:

  1. ~/.config/gnome-mimeapps.list
  2. ~/.config/mimeapps.list
  3. /etc/xdg/gnome-mimeapps.list
  4. /etc/xdg/mimeapps.list
  5. ~/.local/share/applications/gnome-mimeapps.list
  6. ~/.local/share/applications/mimeapps.list
  7. /usr/local/share/applications/gnome-mimeapps.list
  8. /usr/local/share/applications/mimeapps.list
  9. /usr/share/applications/gnome-mimeapps.list
  10. /usr/share/applications/mimeapps.list

请注意,在查找 MIME 类型的首选应用程序时,将按顺序搜索文件,直到找到匹配项,因此如果列表较早的文件中存在该类型,则将类型添加到列表较晚的文件中将不会产生任何效果。

您可能还需要考虑使用诸如 xdg-mime 之类的工具xdg-实用程序(例如xdg-mime default qtcreator.desktop application/vnd.nokia.qt.qmakeprofile),设置关联而不是mimeapps.list直接编辑。

相关内容