this post was submitted on 14 Jul 2024
285 points (94.7% liked)

Linux

48654 readers
710 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Shameless plug: I am the author.

you are viewing a single comment's thread
view the rest of the comments
[–] sfera@beehaw.org 1 points 5 months ago (2 children)

Are there abstractions available around the XDG specifications to resolve the proper paths?

[–] MonkderDritte@feddit.de 7 points 5 months ago* (last edited 5 months ago) (1 children)

What language? Python has PyXDG.

In shell it's simply

XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME"/.local/share}"
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME"/.config}"
etc.
[–] sfera@beehaw.org 2 points 5 months ago

Thanks, I did not know about PyXDG. That was the type of thing I was asking about.

[–] dan@upvote.au 5 points 5 months ago (1 children)

Use the environment variables.

[–] sfera@beehaw.org 1 points 5 months ago (1 children)

I do. But you might have misunderstood my question. I was not asking for assistance. I was just curious if there are libraries available which allow easy adoption of the XDG specification. I imagine that such abstractions would be useful for multi-platform software and generally to lower the bar for adoption.

[–] dan@upvote.au 2 points 5 months ago

Depends on the programming language. In C# for example, there's an API to get special folder paths that works in all supported environments (Windows, Linux, MacOS, Android, and I think iOS too). On Linux, it includes fallbacks in case the environment variables aren't set.