Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm not entirely sure if this is the best way to implement this, TBH. Can't really test things on Windows that easily.
This changes the code to use
$XDG_RUNTIME_DIR/$CORE_D_DOTFILE
on Linux, and falls back upon$HOME/$CORE_D_DOTFILE
.On Windows, it uses
$TEMP/$CORE_D_DOTFILE
, and falls back upon$USERPROFILE/$CORE_D_DOTFILE
.I noticed that Node has
os.tmpdir
andos.homedir
, which might be simpler than checking the environment variables. There'd still need to be an XDG check included with that, but it might be able to remove thehome_env
variable.That having been said, I have no idea if Windows path separators would affect this.
I'm also not sure if there's an appropriate default on macOS. As it stands, I think it would always end up using
$HOME/$CORE_D_DOTFILE
.And I'm not sure whether this should use a subdirectory of the temp dir, or the temp dir directly.
I'm fine with changing anything in this.
Fixes #13, mantoni/eslint_d.js#158 (eventually)