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.
Currently, cod's socket and lock file are placed at
$XDG_DATA_DIR/cod/var
, which isn't a particularly standard location for them.The XDG Base Directory Specification specifies the locations which various files should be stored at. It states:
It further states a fallback for when the variable isn't set:
This PR changes it so that cod will use
$XDG_RUNTIME_DIR/cod
for the socket & lockfile when$XDG_RUNTIME_DIR
is set, and will fall back upon$XDG_DATA_DIR/cod/var
.Since
$XDG_RUNTIME_DIR
has no default value, falling back upon the old seems like the best choice there.In my experience,
$XDG_RUNTIME_DIR
is usually set by pam_systemd, and ends up being set to/run/user/$UID
(which it creates it as atmpfs
). However, I'd prefer to just go with general spec compliance here.I'm probably not the best with Go programming, but I think this implementation should work fine.