Opened 2 years ago

Last modified 2 years ago

#18130 closed bug

XDG_* variables: getenv() gets different results if app is run from a console or from GUI — at Initial Version

Reported by: bipolar Owned by: nobody
Priority: normal Milestone: R1/beta4
Component: - General Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Many ported software makes use of the XDG_* variables ("XDG_CONFIG_HOME", "XDG_DATA_DIRS", etc).

Haiku currently exports those from etc/profile.d/xdg_basedirs.sh.

The problem is that getenv() gives different results if the app is launched from a Terminal window, or by double clicking in it, for example. It gets the proper values in the first case, and NULL on the latter.

Will attach a very basic example app (please excuse the poor code) that exhibits this behavior.

Over haikuports this is currently fixed for many apps by directly patching them, but the fix seems to be simpler... as hinted by Pulkomandy [here https://github.com/haikuports/haikuports/commit/655df3db34b268cb4b2c5947f1dfe323d9a7a1d6]:

just source etc/profile.d/xdg_basedirs.sh from, for example, ~/config/settings/boot/UserSetupEnvironment.

Doing the latter, the attached test case app shows the expected/correct behavior.

Should this enough/valid for ported apps, or am I missing something else?

Change History (0)

Note: See TracTickets for help on using tickets.