Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_default returns incorrect application when multiple mimeapps.list files are present #37

Open
p-himik opened this issue Oct 9, 2018 · 1 comment

Comments

@p-himik
Copy link

p-himik commented Oct 9, 2018

Full disclosure: I'm not a Perl developer, so I can make wrong assumptions here.
Observed behavior: after setting a default app with mimeopen -d %file%, using mimeopen %file% uses the old app and not the new default.

There are these lines: https://github.com/mbeijen/File-MimeInfo/blob/master/lib/File/MimeInfo/Applications.pm#L103-L105
Now, the user's mimeapps.list goes first there, and that's how it's supposed to be.
But then, the list is reversed for some reason. Hence, _find_file always receives the old apps first.

@martintxoz
Copy link

martintxoz commented Aug 17, 2020

I don't know to code anything too. But I find this too useful for me to see why mimeopen was failing...

My problem was: I need to make a new association for open a rar file with engrampa. I don't use a Desktop Environment, but need to associate this for opening rar files from de web browser...

I made this association with mimeopen and works (opening it with xdg-open). But I can't see it if I open it latter with mimeopen only to see what is the defaul app. And the same is if I try to open it with 'mimeopen -n', it try to open the rar file with de Atril pdf viewer!! (the old default), while xdg-open opens it with the new default: engrampa.

If I edit the file /usr/share/perl5/File/MimeInfo/Applications.pm (this is Debian Testing with the default libfile-mimeinfo-perl package), if in the line 105 I delete the 'reverse ' word, now mimeopen is working fine. See the output of mimeopen -d:

  • Without this change:
$ mimeopen -D -d Informes.rar
> Data dirs are: /home/martintxo/.local/share, /usr/local/share, /usr/share
> Checking inode type
> Checking globs for basename 'Informes.rar'
> Checking for extension '.rar'
Please choose a default application for files of type application/vnd.rar

	1) Atril Document Viewer  (atril)
	2) Xarchiver  (xarchiver)
	3) Leafpad  (leafpad)
	4) Other...

use application #
  • With this change:
$ mimeopen -D -d Informes.rar
> Data dirs are: /home/martintxo/.local/share, /usr/local/share, /usr/share
> Checking inode type
> Checking globs for basename 'Informes.rar'
> Checking for extension '.rar'
Please choose a default application for files of type application/vnd.rar

	1) engrampa  (engrampa-usercreated-1)
	2) Xarchiver  (xarchiver)
	3) Leafpad  (leafpad)
	4) Other...

use application #

So I think that it is a bug, and to solve it is needed to edit this lines in Applications.pm.

Thank you in advance. Greetings. Martintxo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants