285
submitted 3 months ago by bahmanm@lemmy.ml to c/linux@lemmy.ml

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 3 months ago

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

[-] MonkderDritte@feddit.de 7 points 3 months ago* (last edited 3 months ago)

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 3 months ago

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

[-] dan@upvote.au 5 points 3 months ago

Use the environment variables.

[-] sfera@beehaw.org 1 points 3 months ago

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 3 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.

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

Linux

48036 readers
804 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