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
scala.sys.env should be case-insensitive on Windows #9957
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9957?orig=1 |
@som-snytt said: |
@Atry said: |
currently closing since scala.sys issues will no longer be tracked here in scala/bug. I've made a "module:scala.sys" label so we can find relevant issues once the module has its own repo |
@SethTisue Is this still the relevant place to talk about this? I've noticed the issue today by chance and I was thinking to use private final class Env extends immutable.Map[String, String] {
override def +[V1 >: String](kv: (String, V1)): Map[String, V1] =
iterator.toMap + kv
override def get(key: String): Option[String] =
Option(System.getenv(key))
override def iterator: Iterator[(String, String)] =
JavaConverters.mapAsScalaMap(System.getenv()).iterator
override def -(key: String): Map[String, String] =
iterator.toMap - key
}
/** An immutable Map representing the current system environment.
*
* @return a Map containing the system environment variables.
*/
def env: immutable.Map[String, String] = new Env
|
If this is not the right place to discuss about this I'd be very happy to move the discussion somewhere else. 😉 |
There is a code comment suggesting they want to remove the related I'd expect the same thinking to apply here, with the additional prejudice that the semantics for case-sensitivity are strange. An updated map would lose its special get. Interacting with process environment is via The proposed solution does have the virtue of not changing the API. |
Shall we just add a |
I couldn't think of how it wouldn't be weird asymmetry, " |
Your argument applies to all usage of |
It's exact the same behavior as Java |
I agree with the previous comments, that conventionally you'd use |
java.lang.System.getenv
is case-insensitive on Windows. Shall we follow its behavior?The text was updated successfully, but these errors were encountered: