Earlier quoted context omitted.
Hidden files on MacOS were used sparingly—the main instance of a hidden file is the file which stores an icon for a folder, if the folder has a custom icon. Hidden files are only hidden from the UI, they appear normally in the command line. The standard Unix folders (usr, var, etc) are also hidden—to be honest, this is a compromise because the Unix filesystem hierarchy sucks, but we are saddled with it for backwards…
For people out there on macOS, you can press Cmd-Shift-dot in Finder to toggle displaying any hidden files (including the standard UNIX hierarchy at /). By the way, I'm pondering setting my XDG_*_HOME vars on Linux/BSD to use the macOS paths like ~/Library, just to see if the standard is actually being followed.
Dotfile madness (2019)
171–180 of 185 posts
Re: Dotfile madness (2019)
#172Earlier quoted context omitted.
>What's the point of hiding some of the files in a directory from user? It only makes things more confusing. If a user doesn't know what .ssh/ or .bash_history are, and it can hurt them to accidentally delete or modify them, why show them by default? It's like training wheels on a bike. >For example the folder might look empty but in fact it could contain thousands of hidden files. You want to delete it as it is empt…
> If a user doesn't know what .ssh/ or .bash_history are, and it can hurt them to accidentally delete or modify them, why show them by default? It's like training wheels on a bike. This is really the problem with the home directory. It’s supposed to be the place where the user puts their files, but it’s also a place where applications put their files, usually without asking the user. The battle is lost - the home dir…
Re: Dotfile madness (2019)
#173Earlier quoted context omitted.
It's just a different variable: USERPROFILE. https://stackoverflow.com/a/42700844/512904 > being Linux but mangling it so it technically works on other platforms Sounds like the easiest way to solve this problem. I don't blame or shame developers for choosing it. This is simple and works everywhere: char * home = getenv("USERPROFILE"); if (home) { // Use home directory } The answer demonstrating the Windows API way h…
The former does not in fact work everywhere, it only works on Windows. Once you have your #ifdef, there is absolutely no point in having the wrong Windows-specific code instead of the right Windows-specific code. Also, look at what you're describing as weird bullshit: a function call with an enum, instead of a function call with a string. The only difference is that you haven't bothered to familiarize yourself with t…
It's just some example code. Real code will probably try a number of variables.
> Calling getenv("APPDATA") is a perfectly fine way of fetching FOLDERID_RoamingAppData
Okay then. Top level post said you needed a Win32 function for this. If you can do that without those functions, I suppose it's easy enough to support.
> calling getpwuid if $HOME was undefined
$HOME is set by login and ssh to whatever is in the passwd database. Can it ever be undefined? Seems like something is seriously wrong if it is.
Re: Dotfile madness (2019)
#174> a Desktop directory. That last one has been created by Steam, which is quite unfortunate as I simply do not have a desktop or a desktop environment on my machine. Chrome and a number of other software insists on creating some of these directories (e.g. Downloads) too. However you can fix that by setting XDG_DESKTOP_DIR and XDG_DOWNLOAD_DIR in ${XDG_CONFIG_HOME}/user-dirs.dir to something else (e.g. your home direct…
I have tried everything under the sun, including user-dirs.dir: % cat ~/.config/user-dirs.dirs XDG_DESKTOP_DIR="$HOME" XDG_DOWNLOAD_DIR="$HOME" Yet still: % ls -ld ~/Desktop drwxr-xr-x 2 mt mt 4096 Oct 22 18:04 /home/mt/Desktop/ Sometimes there's a ~/Downloads directory too. But not today. I have no idea what keeps creating these. It's pretty annoying as I have a lot of intentionally short-named things in my ~ for ea…
systemctl enable --now xdg-user-dirs-update.service
and just to be safe I have a snippet that parses that file and exports the variables in my login shell like .profile(fish in this example but would be similar for other shells)
sed -nE 's/^([^=#]+)=(.*)/set -gx \1 \2/gp' Re: Dotfile madness (2019)
#175As well as some stuff dumped in the home directory too. The defense on both Windows and Linux is to just keep your own documents elsewhere, or at least in a subfolder of the home directory.
Re: Dotfile madness (2019)
#176Earlier quoted context omitted.
strongly disagree - as of 2022, more apps follow the XDG Base Directory Specification than not - in fact, by a wide margin. So by "doing dirty" in your users home directory, you're going against the grain of the ecosystem. It doesn't seem like you understand much about the specification? I'd recommend reading it, or at least a short summary I've made available here: https://xdgbasedirectoryspecification.com/
"Everybody else does it" is not an argument.
Re: Dotfile madness (2019)
#177> You will most likely want to create a default configuration file with sane and sensible default values the first time your program is executed. Please don't. Include the example configuration in your docs (/usr/share/PROG..) and mention it in the manual. Statistically user will have hundreds of apps installed but will only ever customize a small fraction them. So creating config unconditionally on first run is one…
I don't see much of a problem with them being initialized in $XDG_CONFIG_HOME/
Re: Dotfile madness (2019)
#178Earlier quoted context omitted.
strongly disagree - as of 2022, more apps follow the XDG Base Directory Specification than not - in fact, by a wide margin. So by "doing dirty" in your users home directory, you're going against the grain of the ecosystem. It doesn't seem like you understand much about the specification? I'd recommend reading it, or at least a short summary I've made available here: https://xdgbasedirectoryspecification.com/
My home directory has dotfiles for aspell, bash, bzr, cargo, Clojure, CPAN, CVS, Darcs, D-BUS, Dillo, DOSBox, DOSEmu, Emacs, Eclipse, Emacs, ESD, FLTK, fontconfig, FontForge, GForth, GHC, the GIMP, Git, GnuPG, Gnuplot, Guix, IceWM, Idle, Java, John the Ripper, Jython, Links2, MilkyTracker, Mozilla (Firefox), MPlayer, Nethack, Octave, Racket, R, Skeinforge, Slic3r, SSH, SQLite, Subversion, Units, Vim, W3M, WINE, X-Win…
Re: Dotfile madness (2019)
#179Earlier quoted context omitted.
> Nobody should go out of their way to integrate with Windows APIs int writeConfigFile(ConfigFile file) { #if defined(_WIN32) // Windows-specific function #elif defined(__linux__) // Linux-specific function #elif defined(__APPLE__) // macOS-specific function With modern C++, there's probably a way to do this in a nicer manner, and achieve runtime polymorphism with virtual functions or a lambda (function pointer) tabl…
No need for runtime polymorphism for this. The same binary won't be used in different operating systems. This is a classic example of misuse of C++ features just because they exist and a reason why I personally prefer programming in C. What I would do in a case like this is to have three source files each implementing the function for UNIX/Windows/Mac and the build system should take care of compiling the right one i…
I initially did think of simply letting the build system handle it (CMake can do this excellently, as can Meson, probably) by simply choosing different source files for different target OSs, but when typing out the parent comment, I forgot about it in my train of thought.
Come to think of it, this is far more elegant.
Re: Dotfile madness (2019)
#180> a Desktop directory. That last one has been created by Steam, which is quite unfortunate as I simply do not have a desktop or a desktop environment on my machine. Chrome and a number of other software insists on creating some of these directories (e.g. Downloads) too. However you can fix that by setting XDG_DESKTOP_DIR and XDG_DOWNLOAD_DIR in ${XDG_CONFIG_HOME}/user-dirs.dir to something else (e.g. your home direct…
I have tried everything under the sun, including user-dirs.dir: % cat ~/.config/user-dirs.dirs XDG_DESKTOP_DIR="$HOME" XDG_DOWNLOAD_DIR="$HOME" Yet still: % ls -ld ~/Desktop drwxr-xr-x 2 mt mt 4096 Oct 22 18:04 /home/mt/Desktop/ Sometimes there's a ~/Downloads directory too. But not today. I have no idea what keeps creating these. It's pretty annoying as I have a lot of intentionally short-named things in my ~ for ea…