Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up $XDG_DATA_DIRS and adhere to the XDG Base Directory Specification #150

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S XDG_DATA_DIRS=${XDG_DATA_DIRS}:/run/host/usr/share:/var/lib/snapd/desktop:/var/lib/flatpak/exports/share:${HOME}/.local/share/flatpak/exports/share gjs -m
#!/usr/bin/env -S XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share:/usr/share}:/run/host/usr/share gjs -m
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this syntax - can you explain the - or point me to documentation

Copy link
Author

@antecrescent antecrescent Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response! If you are referring to the ${var:-default} shell syntax, it substitutes the default value default if ${var} is unset or null:

From the Bash manpage:

${parameter:-word}
Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sonnyp Can I help you with anything else? :)

Copy link

@nachum37 nachum37 Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response! If you are referring to the ${var:-default} shell syntax, it substitutes the default value default if ${var} is unset or null:

From the Bash manpage:

${parameter:-word}
Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.

@antecrescent

Something doesn't work with this syntax, the following error is received:

$ re.sonny.Junction
/usr/bin/env: only ${VARNAME} expansion is supported, error at: ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}:/run/host/usr/share gjs -m

Maybe env (at least on my arch) does not support this ${parameter:-word} shell syntax.

This syntax works (of course it will overwrite the value)

#!/usr/bin/env -S XDG_DATA_DIRS=/usr/local/share:/usr/share:/run/host/usr/share gjs -m


import { exit, programArgs, programInvocationName } from "system";
import GLib from "gi://GLib";
Expand Down