fun showPathInFileBrowser(path: Path) { try { val isFolder: Boolean = Files.isDirectory(path) val isFile = !isFolder if (isFile && LEnv.OS === OpSys.WINDOWS) { ProcessBuilder("explorer.exe", "/select,", path.toAbsolutePath().toString()).start() } else java.awt.Desktop.getDesktop() .open(if (isFolder) path.toFile() else path.getParent().toFile()) } catch (ie: IOException) { LEnv.LOGGER.warning("Failed to open file browser!", ie) } }
Opens the specified file or folder in the default file browser application of the user 's OS . < p > If a file is specified , on Windows it will also be selected . < /p >