How do I register a file association in Ubuntu

白昼怎懂夜的黑 提交于 2019-12-06 05:44:14

问题


I'm in the process of creating a Ubuntu Installer and I need to register my own file extension I cant find any examples of how to do this.

Could people provide me with some script snippets on how to do this?

NB: Im using InstallJammer to help me create the installer, which allows me to call external scripts - so that is why a script would be beneficial.


回答1:


An InstallJammer installer won't integrate very well with the distribution, but here goes.

Use xdg-mime install and xdg-mime default to set up the mimetype and associate it.




回答2:


The recommended way is to write an ubuntu package, for example with CDBS (overview, docs, examples, bonus non-cdbs tutorial).

Then you add $PACKAGE.sharedmimeinfo and $APPNAME.desktop files in the debian/ directory. The sharedmimeinfo file describes the file type, the desktop file describes your app. The latter should contain a MimeType=application/x-$APPNAME; that matches the filetype.



来源:https://stackoverflow.com/questions/2042680/how-do-i-register-a-file-association-in-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!