Tiny fix on browsers.openDefaultBrowser (#13818)
This commit is contained in:
parent
c6586322ba
commit
dd44701728
1 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue