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() ?: ""
|
||||
when {
|
||||
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(
|
||||
arrayOf("gio", "open", url), // GNOME / GTK
|
||||
arrayOf("kioclient6", "exec", url), // KDE Plasma 6
|
||||
arrayOf("kioclient5", "exec", url), // KDE Plasma 5
|
||||
arrayOf("x-www-browser", url), // Debian / Ubuntu
|
||||
arrayOf("firefox", url),
|
||||
arrayOf("google-chrome", url),
|
||||
arrayOf("zen-browser", url)
|
||||
arrayOf("/usr/bin/xdg-open", url),
|
||||
arrayOf("/usr/bin/gio", "open", url),
|
||||
arrayOf("/usr/bin/kioclient6", "exec", url),
|
||||
arrayOf("/usr/bin/kioclient5", "exec", url),
|
||||
arrayOf("/usr/bin/x-www-browser", url),
|
||||
arrayOf("/usr/bin/firefox", url)
|
||||
)
|
||||
|
||||
var success = false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue