mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
fix(komga-tray): use workaround to open filesystem on Windows
This commit is contained in:
parent
8171cb859e
commit
6059b85e4f
1 changed files with 8 additions and 6 deletions
|
|
@ -16,11 +16,13 @@ fun openUrl(url: String) {
|
||||||
|
|
||||||
fun openExplorer(file: File) {
|
fun openExplorer(file: File) {
|
||||||
logger.info { "Try to open explorer for path: $file" }
|
logger.info { "Try to open explorer for path: $file" }
|
||||||
if (Desktop.isDesktopSupported())
|
when {
|
||||||
Desktop.getDesktop().let {
|
Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE_FILE_DIR) -> Desktop.getDesktop().browseFileDirectory(file)
|
||||||
if (it.isSupported(Desktop.Action.BROWSE_FILE_DIR)) it.browseFileDirectory(file)
|
System.getProperty("os.name").startsWith("win", true) -> {
|
||||||
else logger.warn { "Cannot open explorer: Desktop.Action.BROWSE_FILE_DIR is not supported" }
|
val command = """explorer.exe /select, "${file.absolutePath}""""
|
||||||
|
Runtime.getRuntime().exec(command)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> logger.warn { "Cannot open explorer, not supported" }
|
||||||
}
|
}
|
||||||
else
|
|
||||||
logger.warn { "Cannot open explorer: Desktop is not supported" }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue