Tiny fix on browsers.openDefaultBrowser (#13818)

This commit is contained in:
Juan Carlos 2020-03-31 16:22:24 -03:00 • committed by GitHub
commit dd44701728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,8 @@ const osOpenCmd* =
## ``"open"`` on MacOS and Windows, ``"xdg-open"`` on Linux, BSD, etc. ## ``"open"`` on MacOS and Windows, ``"xdg-open"`` on Linux, BSD, etc.
proc openDefaultBrowser*(url: string) = proc openDefaultBrowser*(url: string) =
## opens `url` with the user's default browser. This does not block. ## Opens `url` with the user's default browser. This does not block.
## The URL must not be empty string.
## ##
## Under Windows, ``ShellExecute`` is used. Under Mac OS X the ``open`` ## Under Windows, ``ShellExecute`` is used. Under Mac OS X the ``open``
## command is used. Under Unix, it is checked if ``xdg-open`` exists and ## command is used. Under Unix, it is checked if ``xdg-open`` exists and
@ -36,6 +37,7 @@ proc openDefaultBrowser*(url: string) =
## ##
## .. code-block:: nim ## .. code-block:: nim
## block: openDefaultBrowser("https://nim-lang.org") ## block: openDefaultBrowser("https://nim-lang.org")
doAssert url.len > 0, "URL must not be empty string"
when defined(windows): when defined(windows):
var o = newWideCString(osOpenCmd) var o = newWideCString(osOpenCmd)
var u = newWideCString(url) var u = newWideCString(url)