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
Added Properties.isLinux to compliment the isWin and isMac methods #4934
Conversation
s/compliment/complement |
how about return a Platform instance? sealed trait Platform
object Platform{
case object Linux extends Platform
case object Windows extends Platform
...
} |
I'm not sure this is a desirable addition. Why would we need to detect Linux specifically, as opposed to Unixy, non-Mac, non-Windows platforms in general? Normally code that uses flags like these is carving the OS world up into three areas: Mac, Windows, Linux/Unix/other.
if we were doing this over again, or if we planned to enumerate lots of platforms, that might be a better choice, but I don't think it's worth redoing — especially in light of my comments above. |
Honestly I'd be okay with having some sort of isNix, or whatever it would be called to detect Linux/Unix/etc. I don't run any sort of BSD or other Unixy-but-not-Linux system, so I don't know what differs between the two or if it is enough to detect separately. For my own use, however, being able to detect at least a Unixy system is what I was looking for, since I run Arch Linux. I know that I could write something like if (!Properties.isWin && !Properties.isMac) But having an actual Perhaps if I made a new pull request for a generalized
Wow, usually I'm enough of a grammar freak to catch things like that... |
For namespace, it's also possible to locally
|
Hmm... |
it seems to me but i'm also in favor to leave things as they are now; when would you use |
It's a matter of ease of use and readability, really. I use Linux as my daily driver and am writing code for Linux. As such, I'd like to be able to do a check to make sure my .jar is running on Linux before doing Linux-file-structure-related tasks, in this case editing the |
OK, so that's what I was wondering: you are actually interested to know if you're on Linux and not any *nix. I don't have a strong opinion in the end; I think |
I'm inclined to merge this as-is, then. |
Added Properties.isLinux to compliment the isWin and isMac methods
thank you Michael! |
No problem! Thanks for merging! |
Noticed that there was a missing isLinux (or isNix?) method in scala.util.Properties to go with Mac and Linux. The added one checks for
os.name startsWith "Linux"
, which was the case on my Arch Linux system. I ranant opt-test
(after opt-build) but it failed with an OutOfMemoryError, which didn't seem like it could even be related to this, so I assumed that it was a problem from elsewhere.This is my first-ever pull request, so please go easy :D