Skip to content

Drop added PATHs on folder leave #1098

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

Merged
merged 2 commits into from
Apr 22, 2025
Merged

Drop added PATHs on folder leave #1098

merged 2 commits into from
Apr 22, 2025

Conversation

Kissaki
Copy link
Contributor

@Kissaki Kissaki commented Apr 21, 2025

Resolves #1078

Previous behavior: Navigating into a folder with a Cargo.yml prepends the target folders to PATH. They never get removed. Navigating into different cargo folders one after the other leads to repeated PATH extensions.

New behavior: Navigating into a folder with a Cargo.yml prepends the target folders to PATH. Leaving a folder with a Cargo.yml drops the target folders from PATH.

There is no guarantee that they were added by the script when entering. The PATH could have had the target entries before entering. However, when using this hook, it seems reasonable to assume that this prepend and drop behavior is desired. It also seems reasonable to assume that build target folders would not be used for normal util operations.

@Kissaki Kissaki marked this pull request as ready for review April 22, 2025 16:02
@fdncred fdncred merged commit d382af3 into nushell:main Apr 22, 2025
1 check passed
@fdncred
Copy link
Contributor

fdncred commented Apr 22, 2025

Thanks. I'm not sure this will work on Windows due to PATH but it's a good test to see if our $env.path is truly case-insensitive.

@Kissaki
Copy link
Contributor Author

Kissaki commented Apr 22, 2025

I tested inspecting $env.PATH within Nushell at least, and that looked fine.

@Kissaki Kissaki deleted the hook-rusty branch April 22, 2025 18:27
@fdncred
Copy link
Contributor

fdncred commented Apr 22, 2025

On Windows?

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.

Rusty paths doesn't unload paths when you exit directory
2 participants