On the Mac, I can use the “open” program to open an image file such as png. The
program is non-blocking, so the Seq("open"....)! returns immediately.
Can someone suggest how to update this function so that it will also work on linux and windows?
Even better if there is a way to do this, non-blocking, directly with scalafx.
def openImageFile(path:Path):Unit = {
import sys.process._
if ("Mac OS X" == System.getProperty("os.name")) {
println(s"open $path")
Seq("open", path.toString).!
} else
println("[warning]: don't know how to display graphical image in OS: "+ System.getProperty("os.name"))
}
It should. I recall it working on the Linux systems I personally tried it on, but this was 10+ years ago. (Though one hopes the situation would have only improved since then, not regressed…)