hedge-dev / hedge-dev/HedgeModManager

XDG paths are hardcoded

Open
#49 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
193
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Right now, LocateGames in ModdableGameLocator.cs hardcodes XDG paths:

https://github.com/hedge-dev/HedgeModManager/blob/3a1c8652a9aedce13e19fe8e335416d8389b7cc7/Source/HedgeModManager/ModdableGameLocator.cs#L290-L299

All of these paths (~/.config, ~/.local/share, etc.) are configurable and have multiple possible values. In my case, HMM couldn't find UnleashedRecomp because it was installed in a different directory in $XDG_DATA_DIRS. (home-manager installed it at /etc/profiles/per-user/quentin/share/applications/UnleashedRecomp.desktop.)

https://specifications.freedesktop.org/basedir-spec/latest/#variables contains the proper resolution logic for each directory; in summary the rules are:

  • Config should be written to $XDG_CONFIG_HOME, or if that is unset, $HOME/.config. ($XDG_CONFIG_DIRS should be searched for read-only config, but I don't think you have any of that?)
  • Applications should be searched for in $XDG_DATA_HOME, or if that is unset, $HOME/.local/share, and then in $XDG_DATA_DIRS, or if that is unset, /usr/local/share/:/usr/share/

In addition, you might want to search for the application by MIME type (x-scheme-handler/unleashedrecomp) instead of searching by .desktop file name, since different packages are using different names for the .desktop file. Though this would overlap with the Flatpak detection; I'm not sure how you might want to handle that.

With the current rules, globally-installed UnleashedRecomp such as the AUR package won't be found.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Source/HedgeModManager/ModdableGameLocator.cs around LocateGames at lines 290-299, then read the linked freedesktop.org Base Directory Specification. Trace how XDG_CONFIG_HOME, XDG_DATA_HOME, and XDG_DATA_DIRS should affect application discovery, including the differing .desktop filenames and MIME-type suggestion. Done means globally installed applications such as UnleashedRecomp can be found in configured XDG locations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.