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

Canonicalize config dir #12136

Merged
merged 10 commits into from Mar 10, 2024
Merged

Conversation

ysthakur
Copy link
Member

@ysthakur ysthakur commented Mar 9, 2024

Description

It turns out that my previous PR, #11999, didn't properly canonicalize $nu.default-config-dir in a scenario where XDG_CONFIG_HOME (or the equivalent on each platform) was a symlink. To remedy that, this PR makes nu_path::config_dir() return a canonicalized path. This probably shouldn't break anything (except maybe tests relying on the old behavior), since the canonical path will be equivalent to non-canonical paths.

User-Facing Changes

A user may get a path with symlinks resolved and ..s replaced where they previously didn't. I'm not sure where this would happen, though, and anyway, the canonical path is probably the "correct" thing to present to the user. We're using omnipath to make the path presentable to the user on Windows, so there's no danger of someone getting an path with \\? there.

Tests + Formatting

The tests for config files have been updated to run the binary using the Director so that it has access to the XDG_CONFIG_HOME/HOME environment variables to be able to change the config directory.

After Submitting

@ysthakur ysthakur marked this pull request as draft March 9, 2024 06:18
@ysthakur ysthakur marked this pull request as ready for review March 10, 2024 06:03
Copy link
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to me.

Ah the sweet difference between nu! and run... (Correction your run is the secret third thing 😄)

@sholderbach sholderbach merged commit a7b2812 into nushell:main Mar 10, 2024
19 checks passed
@ysthakur ysthakur deleted the canonicalize-config-dir branch March 10, 2024 13:06
@hustcer hustcer added this to the v0.92.0 milestone Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants