-
Notifications
You must be signed in to change notification settings - Fork 949
fix: bspConfig sbt.script - use Path
env variable as a fallback for Windows
#7085
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
Conversation
At least one commit author (v.checlyshov@tinkoff.ru) is not linked to a user. See https://help.github.com/en/articles/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user |
e080471
to
14f424b
Compare
@dos65 Thanks for the contribution! |
@@ -63,7 +63,7 @@ object BuildServerConnection { | |||
// For those who use an old sbt script, the -Dsbt.script is not set | |||
// As a fallback we try to find the sbt script in $PATH | |||
val fileName = if (Properties.isWin) "sbt.bat" else "sbt" | |||
val envPath = sys.env.getOrElse("PATH", "") | |||
val envPath = sys.env.get("PATH").orElse(sys.env.get("Path")).getOrElse("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of singling out PATH
and Path
, would it make sense at this point to filter to all keys that becomes PATH
if you turned it to upper case, and pick the first entry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it makes sense. Changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eed3si9n Doesn't it potentially break semantics on *NIX where you could have a variable PATH and also other case variants?
The suggested code gives no guarantee which would be the first.
I would suggest that the “filter to all keys that becomes PATH if you turned it to upper case, and pick the first entry” was only used on Windows (to match Windows semantics) but on *NIX you still only looked for PATH (upper case) We already have special handling for Windows for the name of the sbt launcher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have special handling for Windows for the name of the sbt launcher
Could you point where is this handling defined?
I think the best option would be to reuse/copy-paste the existing logic
… Windows Originally reported in scalameta/metals#4702 (comment)
14f424b
to
a2de064
Compare
Originally reported in scalameta/metals#4702 (comment)