Fix! resolve URL opening in Linux deb and Windows
This commit is contained in:
parent
9fe631f7a9
commit
a628984986
1 changed files with 16 additions and 9 deletions
|
|
@ -76,17 +76,24 @@ fun AboutDialog(onDismiss: () -> Unit) {
|
||||||
val os = System.getProperty("os.name")?.lowercase() ?: ""
|
val os = System.getProperty("os.name")?.lowercase() ?: ""
|
||||||
when {
|
when {
|
||||||
os.contains("win") -> {
|
os.contains("win") -> {
|
||||||
ProcessBuilder("cmd.exe", "/c", "start", url.replace("&", "^&")).start()
|
try {
|
||||||
|
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
|
||||||
|
Desktop.getDesktop().browse(URI(url))
|
||||||
|
} else {
|
||||||
|
ProcessBuilder("rundll32", "url.dll,FileProtocolHandler", url).start()
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
ProcessBuilder("cmd.exe", "/c", "start", "", url).start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else -> { // Linux / Unix
|
else -> {
|
||||||
val candidates = listOf(
|
val candidates = listOf(
|
||||||
arrayOf("gio", "open", url), // GNOME / GTK
|
arrayOf("/usr/bin/xdg-open", url),
|
||||||
arrayOf("kioclient6", "exec", url), // KDE Plasma 6
|
arrayOf("/usr/bin/gio", "open", url),
|
||||||
arrayOf("kioclient5", "exec", url), // KDE Plasma 5
|
arrayOf("/usr/bin/kioclient6", "exec", url),
|
||||||
arrayOf("x-www-browser", url), // Debian / Ubuntu
|
arrayOf("/usr/bin/kioclient5", "exec", url),
|
||||||
arrayOf("firefox", url),
|
arrayOf("/usr/bin/x-www-browser", url),
|
||||||
arrayOf("google-chrome", url),
|
arrayOf("/usr/bin/firefox", url)
|
||||||
arrayOf("zen-browser", url)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var success = false
|
var success = false
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue