Skip to content

fix(rsaccounts): locate the data directory relative to the executable on Linux - #360

Open
jolavillette wants to merge 1 commit into
RetroShare:masterfrom
jolavillette:fix/relocatable-data-dir
Open

fix(rsaccounts): locate the data directory relative to the executable on Linux#360
jolavillette wants to merge 1 commit into
RetroShare:masterfrom
jolavillette:fix/relocatable-data-dir

Conversation

@jolavillette

Copy link
Copy Markdown
Contributor

RS_DATA_DIR is baked in at compile time, so a relocatable tree (AppImage, portable directory, staged install) can never find its own data: the binary reads the host's system-wide path instead, or nothing at all.

On Linux (excluding Android) prefer <exedir>/../share/retroshare when that directory exists, and fall back to RS_DATA_DIR otherwise. System-wide installs and build trees are unaffected.

This covers every file served from the data directory; the web UI in particular, which p3webui resolves as PathDataDirectory() + "/webui/".

Verified on Linux: a binary placed in a relocated tree resolves its own data directory, while the same binary in a build tree still reports RS_DATA_DIR. Full Qt5 build green.

RS_DATA_DIR is baked in at compile time, so a self contained tree (an
AppImage, a portable directory, a staged install) could never find its own
data: the binary kept reading the system wide path of the host, or nothing
at all. Prefer <exedir>/../share/retroshare when that directory exists and
fall back to RS_DATA_DIR otherwise, which leaves regular system installs
and build trees untouched.

This covers every file served from the data directory, the web UI in
particular, which p3webui resolves as PathDataDirectory() + "/webui/".
@jolavillette
jolavillette force-pushed the fix/relocatable-data-dir branch from e739c55 to 62700ff Compare August 6, 2026 23:17
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

Successfully merging this pull request may close these issues.

1 participant