diff options
author | konqoro <capoiosct@gmail.com> | 2017-11-19 04:29:26 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-11-19 03:29:26 +0100 |
commit | aac94e0ab58e9bdc896a59422d4ab9dcb87bb9e3 (patch) | |
tree | eabe815e6424e0ec39d2a981f7d4d62450d605ef /lib/pure/browsers.nim | |
parent | 784d2e871064f5660472174547051bab3761441a (diff) | |
download | Nim-aac94e0ab58e9bdc896a59422d4ab9dcb87bb9e3.tar.gz |
Don't run "kde-open" and "gnome-open" under Unix (#6426)
Diffstat (limited to 'lib/pure/browsers.nim')
-rw-r--r-- | lib/pure/browsers.nim | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/pure/browsers.nim b/lib/pure/browsers.nim index c6a603318..6912b893c 100644 --- a/lib/pure/browsers.nim +++ b/lib/pure/browsers.nim @@ -21,24 +21,18 @@ proc openDefaultBrowser*(url: string) = ## opens `url` with the user's default browser. This does not block. ## ## Under Windows, ``ShellExecute`` is used. Under Mac OS X the ``open`` - ## command is used. Under Unix, it is checked if ``gnome-open`` exists and - ## used if it does. Next attempt is ``kde-open``, then ``xdg-open``. - ## Otherwise the environment variable ``BROWSER`` is used to determine the - ## default browser to use. + ## command is used. Under Unix, it is checked if ``xdg-open`` exists and + ## used if it does. Otherwise the environment variable ``BROWSER`` is + ## used to determine the default browser to use. when defined(windows): - when useWinUnicode: - var o = newWideCString("open") - var u = newWideCString(url) - discard shellExecuteW(0'i32, o, u, nil, nil, SW_SHOWNORMAL) - else: - discard shellExecuteA(0'i32, "open", url, nil, nil, SW_SHOWNORMAL) + var o = newWideCString("open") + var u = newWideCString(url) + discard shellExecuteW(0'i32, o, u, nil, nil, SW_SHOWNORMAL) elif defined(macosx): discard execShellCmd("open " & quoteShell(url)) else: - const attempts = ["gnome-open ", "kde-open ", "xdg-open "] var u = quoteShell(url) - for a in items(attempts): - if execShellCmd(a & u) == 0: return + if execShellCmd("xdg-open " & u) == 0: return for b in getEnv("BROWSER").string.split(PathSep): try: # we use ``startProcess`` here because we don't want to block! |