1. /usr/share/mime/glob, get MIME type here by extent name.
2. /usr/share/applications/defaults.list. get name of the .desktop file, which associated with this MIME type get in step 1.
3. the .desktop file is right under the same directory of defaults.list. you can find the command to open files have the extent name, which is the value of 'Exec'. just replace the '%U' with you file name.
2. /usr/share/applications/defaults.list. get name of the .desktop file, which associated with this MIME type get in step 1.
3. the .desktop file is right under the same directory of defaults.list. you can find the command to open files have the extent name, which is the value of 'Exec'. just replace the '%U' with you file name.
本文介绍了一种方法,通过三个步骤确定文件的MIME类型及其对应的默认打开应用程序。首先,利用/usr/share/mime/glob路径下的工具通过文件扩展名获取MIME类型;接着,在/usr/share/applications/defaults.list中找到与该MIME类型关联的.desktop文件;最后,在同一目录下找到该.desktop文件,并从'Exec'字段中获取打开文件所需命令。
2万+

被折叠的 条评论
为什么被折叠?



