Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect the XDG Base Directory Specification #3624

Open
linkmauve opened this issue Jul 14, 2015 · 15 comments
Open

Respect the XDG Base Directory Specification #3624

linkmauve opened this issue Jul 14, 2015 · 15 comments
Assignees

Comments

@linkmauve
Copy link

Currently, emscripten is putting a bunch of files right in the user’s home directory. This needlessly pollute the home directory with files whose role isn’t always obvious to the user.

http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html is a specification in use since about 2003 which describes where to put application files using simple rules, in user-modifiable directories.

On my system there are four files and directories being created, I would suggest moving them that way:

  • $HOME/.emscripten$XDG_CONFIG_HOME/emscripten/config (defaults to $HOME/.config/emscripten/config)
  • $HOME/.emscripten_cache__last_clear$XDG_CACHE_HOME/emscripten/last_clear (defaults to $HOME/.cache/emscripten/last_clear)
  • $HOME/.emscripten_sanity$XDG_CACHE_HOME/emscripten/sanity (defaults to $HOME/.cache/emscripten/sanity)
  • $HOME/.emscripten_ports$XDG_DATA_HOME/emscripten/ports (defaults to $HOME/.local/share/emscripten/ports)

I’m not totally sure how to handle that in a cross-platform way, on Linux and *BSD it’s a given this scheme is expected by users, but OSX and Windows have different default directories I think, so you might want to keep the old location for them.

There is also the issue of migration, I don’t know how exactly you would want to handle that, if it is ok to just move the old files to their new location, or if you prefer to read the new location and if there is no file there to fallback to the legacy one, or just to change the location without bothering with any migration plan.

@kripken
Copy link
Member

kripken commented Jul 14, 2015

Emscripten uses Python for this - do you know if there is a good way to do it in Python, that would automatically work across platforms? Right now we just ask Python for the "home dir", I am wondering if there is a proper way to get the right XDG dir.

@linkmauve
Copy link
Author

There is pyxdg available in pypi, but I think it would be best to only take the relevant functions, as they are simple enough to not warrant a dependency.

@kripken
Copy link
Member

kripken commented Jul 20, 2015

I agree it would be better to not take a dependency for this.

@nazar-pc
Copy link
Contributor

nazar-pc commented Jul 8, 2017

I'd like to add to the list following files besides mentioned that appear in my setup):

  • .emrun.generated.guid
  • .emscripten_cache.lock

What Emscripten currently does in home directory is a mess.

@juj
Copy link
Collaborator

juj commented Jul 14, 2017

This is avoided at least when using Emscripten SDK, if the SDK is configured in --embedded mode. In that mode, all configuration is activated in the directory of the SDK instead, with no modifications done to user's home directory. This allows one to have multiple Emscripten SDKs enabled side by side, but it does require the environment variable EM_CONFIG to be specified when invoking Emscripten, so that it knows where to look for the configuration file (this environment variable is populated by Emscripten SDK on SDK terminal activation step)

@juj
Copy link
Collaborator

juj commented Jul 14, 2017

The file .emrun.generated.guid is created if you run emrun --system_info or python tests/runner.py other.test_emrun_info, i.e. it is only part of emrun's info print, and tested by that one test, but it's not used by Emscripten itself. You can safely delete this file, and in normal compiler execution this is never created.

@nazar-pc
Copy link
Contributor

Good to know I can remove those files, but the thing is that they shouldn't be created directly in my home directory in the first place.

@stale
Copy link

stale bot commented Aug 30, 2019

This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Aug 30, 2019
@nazar-pc
Copy link
Contributor

Issue is still relevant

@stale stale bot removed the wontfix label Aug 30, 2019
@sbc100 sbc100 self-assigned this Aug 30, 2019
@kripken
Copy link
Member

kripken commented Aug 30, 2019

I've noticed other projects (like e.g. wasmer) creating a single directory ~/.projectname/. That's just one thing in the user directory, and easy to do cross-platform, but I guess not XDG-compliant.

@nazar-pc
Copy link
Contributor

Well, I don't like that many apps decide they are important enough to create own directory in my ~, let alone multiple directories and files. Something under ~/.config, ~/.cache and ~/.local/share is much better on Linux at least and should not be that hard to manage.

@sbc100
Copy link
Collaborator

sbc100 commented Aug 30, 2019

I agree with @nazar-pc here. However I kind of have plan to try to eliminate stuff from the home directory in most cases. But after I'm done I'll be sure that any remaining stuff goes in ~/.config, ~/.cache and ~/.local.

We basically have three types of users:

  1. emsdk users
  2. distro-package users
  3. users who git checkout and build stuff themselves
  4. developer who work on emscripten itself

3 and 4 are basically the same. Not that (1) and especially (2) may not have write access to the emscripten directory. However (1) and (2) also shouldn't need a config file at all because it all pre-configured for them.

In my ideal world the emscripten config belongs in the emscripten directory itself and any ports that get build belong in emscripten/system/usr/.. somewhere. I looks like this idea was started with the --embedded emsdk option which almost does this already.

Anyway.. I'm hijacking this issue here. I should start a fresh one.

@rajeebk
Copy link

rajeebk commented May 26, 2020

It would be nice to have some documentation of what files are for what purpose so package maintainers can also write their own script to populate to appropriate xdg directories instead of relying on pyhon.

So far I can deduce that *.bat are DOS files and not needed for Linux/Mac, and cmake can be installed in appropriate cmake sub-directory. But I'm not sure about site, src, system, and tools.

@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Jun 2, 2021
@Earnestly
Copy link

Here is some activity, ridiculous bot usage.

@stale stale bot removed the wontfix label Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants