Shameless plug: I am the author.
Golang puts shit specifically in
$HOME/go
. Not even.go
. Just plaingo
.Why is it so difficult to follow industry standards
That’s what happens when you don’t set $GOPATH I think
That doesn’t make it better.
It makes it insofar better to me that you have the option to change it. You can’t change Mozilla programs to use anything but .mozilla (apart from modifying the source code of course) so for me seeing the folder is at least a way of telling me that the variable is unset.
The better question is which folder is suited the best to store the stuff that goes into $GOPATH
Just because something is worse, doesn’t make the other thing good. A sane and standard default, as others have mentioned, is a small bar to meet.
Of course, but that’s not the point. There should be a sane default, and there isn’t one
Google
following industry standards
pick one
This post literally links to the leading one.
off the shelf go was too annoying for me
Nowadays I set GOENV_ROOT to an XDG location and use goenv instead.
Go pisses me off with that. I separate projects the way I want but go wants every project written in go in one big directory?
deleted by creator
What I want in
$HOME
are the following directories:If I’m on a GUI-based environment:
- Desktop
- Documents
- Downloads
In general:
- .local
- my_junk_folder_i_made
I’d like everything else to live within something like ~/.local thanks
Maybe Linux should have
.local
and.roaming
folders like Windows. local = only useful on this system, roaming = good to sync across systems. Config would be in.roaming
if it’s not machine-specific.The only practical difference between Local and Roaming and LocalLow is that developers randomly pick one and dump your game saves in there.
Does
~/.config
fit the bill for the second one?
I wish they used them all, especially
XDG_CACHE_HOME
which can become pretty big pretty fast.And i wish there was a separate XDG_LOG_HOME or $HOME/.local/log, with logrotate preconfigured to look there.
Or
$HOME/.var/log
.
Shout out to xdg-ninja - it’ll find files that are in your home and suggest how to configure the app to use XDG instead. https://github.com/b3nj5m1n/xdg-ninja
Strange that some apps allow configuring it rather than just doing it automatically…
That’s the usual open source way. The config probably came later so they just added the option without changing the default because that would break backward compatibility.
And there would be too much boring work to build a migration.
100% agree and I also despise devs who do this on windows, instead of using %appdata% they’re using c:\users\username\.myappisimportantandtotallydeservesthisdir
I have to use a separate Documents folder for my actual documents lol
I think that also causes issues for roaming profiles and folder redirection. If roaming is turned on then everything in the %appdata%\roaming folder is synced to a server. %AppData%\Local is not. So if your app is using %AppData%\Roaming for temporary data then you are causing a whole bunch on unnecessary IO. Same for using Documents since that if often synced.
To be fair here, appdata is technically a hidden folder and there are lots of reasons an app would want it’s data accessable by the user.
Yes but then just spam the documents folder like anyone else, don’t hoard the home root for no reason except that is a lazy cross platform port
I didn’t know about this (and thankfully, haven’t written anything public). I’ve been trying to fix an install script for an OSS project that doesn’t work on immutable distros, and using the XDG Base Directory specs might just be the panacea I was looking for!
Here is a more concise way to achieve the same thing:
ls -ACd ~/.??*/ | sed -e "s#$HOME/##g"
I think that can be boiled down to only
cd; echo .*/
Maybe throw a
;cd -
on the end if the change of directory is unwanted.if you need to preserve
cd -
you might be able to do this withpushd
andpopd
ls -A | grep "^\."
I had to make a dummy
.dotfile
to test because I don’t have hidden files in my home.
Where did i read this… basically, the .file being hidden being a bug in the early unix filesystem, which got misused to hide configuration files.
Offenders despite XDG-variables set and with no workaround:
- .android: hardcoded in adb and i guess something in mtp too
- .pki: some tool/library Firefox and Chromium sometimes use.
- .steam: yes, that
there’s no place like 127.0.0.1
there’s no place like XDG_CONFIG_HOME.
Shameless flex
I regret checking this
vim now has an option to put the .vim folder in ~/.config; though I’m not sure if the default plugin/package & syntax folders can be set under ~/.local/share.
YOU’RE NOT MY MOM I’LL DO WHAT I WANT
Are there abstractions available around the XDG specifications to resolve the proper paths?
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.
Thanks, I did not know about PyXDG. That was the type of thing I was asking about.
Use the environment variables.
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.
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.
BRB, putting in a PR to make /etc mode 1777 by default.
حق
Probably half the entries in that list are not GUI apps, and XDG doesn’t apply (though some still support it). For some others there (like emacs) XDG is used if it exists.
XDG doesn’t apply for CLI apps? About half of dirs I still have cluttering my home are GUI apps whose devs refuse to follow the specification, while I see less friction from CLI/TUI devs, since they’re the ones actually seeing these hidden locations.
What makes you think XDG doesn’t apply to non GUI apps?
It’s already in the name - XDG stands for X Desktop Group (nowadays freedesktop), which works on interoperability for desktop environments. In a pure shell environment (or even if you’re not running a full desktop) none of the XDG variables are defined, and especially in shell environments the default fallbacks specified by XDG are not necessarily what the operator would expect.
That name is decades old. XDG stands for “Cross Desktop Group”.
A “pure” X environment (e.g.
startx xterm
) also doesn’t define those variables, but many desktop environments do, just like many shell configurations do.