mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
Tiny fix on browsers.openDefaultBrowser (#13818)
This commit is contained in:
@@ -25,7 +25,8 @@ const osOpenCmd* =
|
||||
## ``"open"`` on MacOS and Windows, ``"xdg-open"`` on Linux, BSD, etc.
|
||||
|
||||
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``
|
||||
## command is used. Under Unix, it is checked if ``xdg-open`` exists and
|
||||
@@ -36,6 +37,7 @@ proc openDefaultBrowser*(url: string) =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## block: openDefaultBrowser("https://nim-lang.org")
|
||||
doAssert url.len > 0, "URL must not be empty string"
|
||||
when defined(windows):
|
||||
var o = newWideCString(osOpenCmd)
|
||||
var u = newWideCString(url)
|
||||
|
||||
Reference in New Issue
Block a user