xdg-desktop-portal
xdg-desktop-portal copied to clipboard
Also load portals from XDG_DATA_DIRS
Addresses issue #603. The only place it searches for portals is the DATADIR or XDG_DESKTOP_PORTAL_DIR, but if XDG_DESKTOP_PORTAL_DIR is set, then it doesn't read configuration files.
This is a problem because any system that doesn't follow the FHS must set XDG_DESKTOP_PORTAL_DIR for it to find the portals, but then can't load any configuration files which leaves everything broken. A simple solution is to search all the directories in XDG_DATA_DIRS.
I really would want to have tests for the configs. With the pytest setup we currently have, we can only test config in $HOME but we could modify things for this test to launch x-d-p in a new mount namespace with /usr/local/share/xdg-desktop-portal etc under our control.
Is that something you could look into?
With the pytest setup we currently have, we can only test config in $HOME but we could modify things for this test to launch x-d-p in a new mount namespace with
/usr/local/share/xdg-desktop-portaletc under our control.
If we do this, please only do it as additional test coverage, and not as the only way some other thing gets tested. Linux distributions' autobuilders usually can't create new mount namespaces so this would have to be skipped.
Alternative to unshare for testing: introduce environment variables that overwrites the "system" dirs. Should work everywhere then at least.
For reference this is how nix deals with the not loading configuration files problem.
Somewhat related; this is what we use in GNU Guix: https://github.com/flatpak/xdg-desktop-portal/pull/1716
2 wrongs don't make a right.
Looks like since https://github.com/flatpak/xdg-desktop-portal/pull/1665 has been merged, we can now use XDG_DATA_DIRS instead of (ab)using the XDG_DESKTOP_PORTAL_DIR environment variable, which appears to be catering to the test suite only?
Yes, please drop the patch that abuses XDG_DESKTOP_PORTAL_DIR. It's for the test suite only.
Closing in favor of https://github.com/flatpak/xdg-desktop-portal/pull/1665