The more I think about the Unix filesystem, the less sense it makes.

/home is for user's files, but there's no organization for applications

/var is for daemons, but you need root's permission to make a directory there

/tmp doesn't require special permission, but those files are deleted on reboot

Applications should be able to simply ask the system for places to put files it needs to persist and those it doesn't.

· · Web · 2 · 0 · 3


yeah, I don't know them well, but have been pretty salty to have started learning them, only to see that flatpak for instance just goes off and does it's own, different thing from all of the above. (It creates and puts stuff in ~/.var/ of all places!)

@deejoe @emacsen that's one of my favourite things about Flatpak, that I know where each application has its files, regardless of where the program think they should be.

@emacsen I'm just reading your explanation and makes perfect sense to me.

Probably because I'm very used to it?


Then let me give you my example. I'm writing a tiny little web application that has a file for keeping state.

Where should the state file live? Do I need to ask permission from root to create a /var directory? I didn't need that for anything else.

@emacsen How do you run this service?

If it's a system-wise service running under its own user, it's up to your system daemon to create, chmod and chown your state folder in /var before spawning the service. With systemd, you do that via the StateDirectory= service directive. More infos there:

If it's a user service, then as @ekaitz_zarraga said, XDG_DATA_HOME.

Note, there's actually another layer to this mess: the runtime dir in /run for your temporary state. Usually this directory gets mounted on tmpfs as well (ie. do not persist across reboot). You usually store your secrets there.

Overall, agree, it's pretty messy.

@emacsen This might be stockholm syndrome, but I *really* hate the idea of organizing files by application. Partly I think that's just a strange way to organize things (surely I want all my files for a certain course together, regardless of type), and partly I hate the implied lockin of tying files to particular applications.


Would it be so terrible to "connect" application files together when you need to?

After all, you're talking about the exception rather than the norm.

Right now your screen saver can read all your email and go through your web browser cache.

Do you think that's a good thing?

@emacsen Well, the exception is 35 years of muscle memory for me, so yeah, I might be a little resistant to change. I prefer that everything is a text file, that I can version control. I don't expect everyone to love my way of working, but I don't wish to be forced to change.

@emacsen @bremner having various different file types in a logical thing is in no way an exception... that's the normal case for me
Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!