Closed bjornregnell closed 3 years ago
I agree, that's a better way to do it. I can take a look at this later today.
Ok good. I just made one refactoring here: https://github.com/lunduniversity/introprog-scalalib/commit/ff3806a61a58ef935b713550b78651a65c17c387 But haven't touched the process -> file-check stuff so feel free to do that. Perhaps there are stuff in introprog.IO that can be used for this....
I've now created a pull request with a changed isInProc()
, see #30
This PR https://github.com/lunduniversity/introprog-scalalib/pull/27 includes a hopefully feasible way to detect OS and set the right look and feel so that window stuff does not crash on WSL + GWSL, and we should test that in as many setups as possible including Windows 11.
However, the code could be refactored to be more elegant and easier to read and also more effective:
We should use java's File stuff instead -- it's unnecessarily heavy to fire up a whole new OS process just to check what's in a file. I did not question the tip on how to detect WSL. So before we make an ordinary release to Maven central 1.3.1 we should fix this. And the isInProc is an implementation detail that should not be visible outside, and actually a part of isOS so that method should use a private isInProc. If so, the code would feel more "natural".