Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Move .atom config to $XDG_CONFIG_HOME on linux #2199

Closed
aviau opened this issue May 13, 2014 · 21 comments
Closed

Move .atom config to $XDG_CONFIG_HOME on linux #2199

aviau opened this issue May 13, 2014 · 21 comments
Labels
enhancement linux Issues that occur on Linux but not on other platforms.

Comments

@aviau
Copy link

aviau commented May 13, 2014

From feedesktop.org:

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

Source: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Thanks!

@aviau aviau changed the title Move config to $XDG_CONFIG_HOME on linux Move .atom to $XDG_CONFIG_HOME on linux May 13, 2014
@aviau aviau changed the title Move .atom to $XDG_CONFIG_HOME on linux Move .atom config to $XDG_CONFIG_HOME on linux May 13, 2014
@cgtx
Copy link

cgtx commented May 14, 2014

This is important to me as well.

@cadesalaberry
Copy link

👍

@malko
Copy link

malko commented May 15, 2014

👍

@alexwhitman
Copy link

So this should be fairly straight forward by updating https://github.com/atom/atom/blob/master/src/atom.coffee#L90 - Something like

  @getConfigDirPath: ->
    if process.platform is 'win32'
      dir = process.env.APPDATA
    else if process.platform is 'darwin'
      # osx path
    else
      dir = if process.env.XDG_CONFIG_HOME then process.env.XDG_CONFIG_HOME else '~/.config'
    @configDirPath ?= fs.absolute(dir + '/atom')

which will use $XDG_CONFIG_HOME/atom if $XDG_CONFIG_HOME is set, otherwise fall back to ~/.config/atom.

I'm not sure what the equivalent would be for OSX.

@pritambaral
Copy link
Contributor

It would need to be updated in the docs. What do we replace ~/.atom with in documentation? A short word would be nice.

I'm in the process of doing this. If anybody has a suggestion regarding darwin's location, please tell. For now, I'm leaving it as ~/.atom.

@alexwhitman
Copy link

Looks like OS X should be in /Users/<username>/Library/Preferences. Username can be retrieved with https://www.npmjs.org/package/username

@pritambaral
Copy link
Contributor

The build process also utilises ~/.atom as a cache. Better move to $XDG_CACHE_HOME while we are at it.

@pritambaral
Copy link
Contributor

@alexwhitman I see that https://www.npmjs.org/package/username looks at various system env variables.
BTW, fs-plus already has getHomeDirectory() and .absolute('~/Library/Preferences'). Can you test the latter?

@alexwhitman
Copy link

@pritambaral
Copy link
Contributor

Ah, stackoverflow is dead here. Apparently they updated all their BGP routes today. Anyway, I'm going to stay with the status quo on OS X: ~/.atom, for now.

@rnhmjoj
Copy link

rnhmjoj commented Aug 28, 2014

The status quo on OSX it's not the dotfile. OSX applications use ~/Library/Preferences/[identifier].plist to store preferences in text format. One file only.
Other data goes into ~/Library/Application Support/[app-name]/
Since .atom stores not only preferences but also packages repo and caches ~/Library/Application Support/is the most appropriate.
See Apple docs: 1 2

@kevinsawicki
Copy link
Contributor

There is now full support for configuring the config location via the ATOM_HOME environment variable via #5385.

I'm going to close this issue out since changing the default location at this point is unlikely given how many Atom installs are already out there.

@aviau
Copy link
Author

aviau commented Feb 4, 2015

So Atom will never ever respect the freedesktop standard? Its a shame, 1.0 wasn't released yet. Now should be the moment to make things right.

@kevinsawicki
Copy link
Contributor

Switching to this standard would require reworking more than just one path since XDG_CACHE_HOME should be used for Atom's compile cache, and XDG_RUNTIME_DIR should probably be used for installed packages & themes.

Currently these are all stored under ~/.atom. Having all of them co-located makes it incredibly easy to backup, transfer, and clean out your machine of all Atom related files. Also using the same path on all platforms makes Atom predictable for people using multiple platforms.

@cgtx
Copy link

cgtx commented Feb 4, 2015

One of the benefits of XDG Base Directory Specification is that a user can back up configurations and data, but not cache. Forcing all of Atom's data under one directory means that it is much more difficult to do this.

@vially
Copy link

vially commented Feb 6, 2015

using the same path on all platforms makes Atom predictable for people using multiple platforms

I think people using multiple platforms are accustomed with different operating systems having different file system layouts. If we were to take this reasoning to the extreme you might be tempted to install the Atom binary in a "/usr/Program Files" directory while on a Linux/Mac machine and I don't think there's anyone who would argue that that's just plain wrong.

Given that Atom is still not considered stable I think it's still not too late to change this to support the XDG standard. And while I agree that doing it properly requires a little bit more work to be fully compliant, I think that if the Atom team shows interest in supporting the standard, someone might be able to come up with a pull request to implement it.

@malko
Copy link

malko commented Feb 6, 2015

👍
I'm working on different platforms and i'm always looking first for platform specific path in first place.

@Dremora
Copy link

Dremora commented Feb 17, 2015

Changing default location should never be an issue as long as it's done in a backwards-compatible way, no matter how large the user base is.
A common workaround is to define not one, but multiple config paths, and pick up the first existing one. This list of paths should be OS-specific, with $ATOM_HOME taking the precedence over everything else. Then, if the config directory is nowhere to be found, it should be created at the first OS-specific location.

I've noticed, however, that on OS X, the configuration is spread across two directories — ~/.atom and ~/Library/Application Support/Atom. The latter seems to be used for blink-specific files, while the earlier is for user configuration. This unfortunately doesn't help, because ~/Library/Application Support/Atom is the default location for non-plist configuration on OS X, and it's the one where ~/.config should go. Looks like the Linux version has an additional directory ~/.config/Atom-Shell which is likely the same (strangely enough, it's called Atom, not Atom-Shell on OS X).

@rbellamy
Copy link

I'm on Linux (Arch) and have both $ATOM_HOME/.atom (because I set it in my .profile to $XDG_CONFIG_HOME/.atom) and ~/.config/Atom (NOT ~/.config/Atom-Shell).

@colemickens
Copy link

I also have .atom and .config/Atom. Is one of them old now? Looking at their contents, they look quite different.

ls ~/.config/Atom
Cache  Cookies  Cookies-journal  DevTools Extensions  GPUCache  Local Storage

ls .atom/
compile-cache  config.cson  nohup.out  packages  storage  terminal-commands.json

Ugh, can't believe this was closed... it should be done the right way. ATOM_HOME is like a slap in the fact to the entire point of XDG.

@lock
Copy link

lock bot commented Jan 21, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement linux Issues that occur on Linux but not on other platforms.
Projects
None yet
Development

No branches or pull requests