开发者

How do I register a file association in Ubuntu

开发者 https://www.devze.com 2022-12-16 04:43 出处:网络
I\'m in the process of creating a Ubuntu Installer and I need to register my own file extensionI cant find any examples of how to do this.

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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消