Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Unable to set persistent rom file associations on Linux #136

Open
pgattic opened this issue Nov 13, 2022 · 2 comments
Open

Unable to set persistent rom file associations on Linux #136

pgattic opened this issue Nov 13, 2022 · 2 comments

Comments

@pgattic
Copy link

pgattic commented Nov 13, 2022

First of all, I really appreciate this emulator as it has served me well in debugging and romhacking for years, wanted to extend my gratitude.

However, on Linux with KDE desktop environment I have run into this issue where I am unable to consistently run my NES ROMs through Mesen by double-clicking them. I go into the default applications settings, and set Mesen to the NES ROM default application, and it works once, but then the file association disappears the next time I run Mesen. This has happened to me on both Ubuntu and Pop!_OS running KDE (on two separate computers) and I can shortly test it on GNOME too.

Steps to reproduce (on Linux):

  1. Set x-nes-rom file association to Mesen (could be done through Mesen's app launch settings, through the system settings, or through clicking any ".nes" ROM).
  2. Run Mesen and close it
  3. See that the next time you try to run a .nes file through doubleclick or xdg-open, it says there is no associated app

I have a feeling this problem is related to Mono, does anyone else know of other mono-compatible Windows apps that have a similar problem? And more importantly, does anybody have a workaround?

@pgattic
Copy link
Author

pgattic commented Nov 13, 2022

Okay just realized the source of the issue, it is because the ".desktop" file (found in ~/.local/share/applications) for Mesen is renamed every time the app is launched, as it gets this weird string of characters in its name. Since xdg's file associations are made by reference to ".desktop" files, renaming these breaks the association. I don't know if this renaming is related to Mono or to Mesen, but it is still kind of annoying.

But still, I am looking for solutions. Anyone know how to solve this problem?

pgattic added a commit to pgattic/Mesen-X that referenced this issue Nov 13, 2022
It seems to me that when the emulator gives the ".desktop" file a new GUID in its filename every time it runs, it kind of makes things a hassle for people who manually organize or manage their desktop shortcuts on Linux. See NovaSquirrel#136 for an example of this. (But there's probably someone who knows more about this than I do who can confirm or deny what I'm saying.)

I am not the most familiar with the code for this emulator, but it almost looks like if this proposal is implemented, it could also be helpful to move line 170 of /GUI.NET/Config/PreferenceInfo.cs to after line 72 in GUI.NET/Forms/frmConfigWizard.cs so that it only creates the .desktop file once upon setup and not each time the app is run.
@pgattic
Copy link
Author

pgattic commented Nov 13, 2022

Found the source of the problem. Just made a PR for some suggested fixes. But I am only so sure that it won't cause issues somewhere else.

But in the meantime, I have a hacky solution for anyone else who is desperate to make file associations to Mesen in Linux. This does solve the problem, but has an annoying side effect.

  1. Make a copy of the file "mesen.[RandomNumbersAndLetters].desktop" found in ~/.local/share/applications, and rename it to just "mesen.desktop"
  2. Run xdg-mime default ~/.local/share/applications/mesen.desktop x-nes-rom from the command line

Side effect: Mesen will now have two entries in your apps list and start menu. Both shortcuts work the same, but its a bit annoying to have both.

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

No branches or pull requests

1 participant