libretro / libretro/RetroArch

Make RA more friendly to user fallback dirs

Open
#10,604 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

Description

Many operating systems want to place 'system dirs' into read only parts of the filesystem. This is by design for the packaging tools of those systems where user dirs are not available.

What this means in effect is if the program tries to save something, it can't. If the user tries to add some shader, he can't, without changing the config and copying over the old contents, changing permissions etc.

There is a alternative, but as it is only used in these conditions (flatpak, system wide linux, bsd, etc), Retroarch doesn't use it.

Expected behavior

Whenever RA uses a path cfg property, libretro (i think this is best done there) would allow at build time both a 'system dir' (--datarootdir= IIRC) and a 'user dir' (--userdatarootdir= ). Then when the cfg files are written the default would be the 'userdatarootdir' if it exists, but when files are requested the function that would replace direct access first checks the 'userdatarootdir' and if the file is not found there, the 'datarootdir'. Write access would always go to userdatarootdir if specified, so this clearly requires "rw" flags to work 'well', so you have a skeleton of a api.

FILE * getConfPath(char* key, char*file, char * flags); where inside if write is specified you just return cfg[key]/file but if only read is specified you return the first where file exists, or if the file does not exist, the user writable directory or a error (depending on how forgiving you want this to be).

There might be a better, transparent solution with virtual filesystem overlays, which i recall libretro was experimenting with.

Actual behavior

Plenty of platform specific bugs of users trying to write in read only system directories.

Contributor guide

Open the contributing guide

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 by locating RetroArch's cfg path properties and the libretro path-handling entry points. Define how build-time system and user directories should be selected for reads and writes, including read-only system directories and missing files; done means platform-specific writes no longer target those directories while reads can fall back.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.