Skip to content

Every .tool-versions needs a .envrc? #101

Answered by jfly
gullitmiranda asked this question in Q&A
Discussion options

You must be logged in to vote

Ooh that's a very interesting point, and I can see the confusion. Unfortunately, I don't think we can change this behavior in any sane way, as direnv executes .envrc files with cwd set to the folder that script is in. In other words, in your example, from within the ~/project/.envrc file, there's no way to tell the difference between "we're currently in ~/project" and "we're currently in ~/project/sub-project/".

This is actually good and useful behavior for direnv to have. If it didn't act that way, you might experience different behavior in this two situations:

  1. cd-ing directly from ~ to ~/project/sub-project
  2. cd-ing from ~ to ~/project and then to ~/project/sub-project

In scenario 1), y…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jfly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants