summary refs log tree commit diff stats
path: root/tests/compiles
Commit message (Collapse)AuthorAgeFilesLines
* delete list comprehension (#12392)Arne Döring2019-11-221-8/+0
| | | The `lc` macro is now part of `graveyard` repository.
* make run the default action of a test in testerArne Döring2018-11-231-0/+4
|
* Allow taking address of skForVar variables (#8632)LemonBoy2018-08-141-0/+13
| | | Fixes #8630
* make tests green againAndreas Rumpf2018-05-021-2/+2
|
* Remove expr/stmt (#5857)Arne Döring2017-07-251-5/+7
|
* renamed inCompilesContext to compilesContextId; added test case for #3313Araq2015-09-181-0/+98
|
* fixes #1055Araq2014-11-161-0/+12
|
* bugfix: unreported 'compiles' bugAraq2014-03-051-0/+2
|
* new tester; all tests categorizedAraq2014-01-131-0/+26
*/ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#
#
#            Nim's Runtime Library
#        (c) Copyright 2012 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## This module implements a simple proc for opening URLs with the user's
## default browser.

import strutils

when defined(windows):
  import winlean
else:
  import os, osproc

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.
  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)
  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
    for b in getEnv("BROWSER").string.split(PathSep):
      try:
        # we use ``startProcess`` here because we don't want to block!
        discard startProcess(command=b, args=[url], options={poUsePath})
        return
      except OSError:
        discard