minor improvements to os.paramStr
This commit is contained in:
parent
d94950ef80
commit
46dffbed71
1 changed files with 3 additions and 2 deletions
|
|
@ -1429,7 +1429,7 @@ when defined(nimdoc):
|
||||||
proc paramStr*(i: int): TaintedString {.tags: [ReadIOEffect].} =
|
proc paramStr*(i: int): TaintedString {.tags: [ReadIOEffect].} =
|
||||||
## Returns the `i`-th `command line argument`:idx: given to the application.
|
## Returns the `i`-th `command line argument`:idx: given to the application.
|
||||||
##
|
##
|
||||||
## `i` should be in the range `1..paramCount()`, the `EInvalidIndex`
|
## `i` should be in the range `1..paramCount()`, the `IndexError`
|
||||||
## exception will be raised for invalid values. Instead of iterating over
|
## exception will be raised for invalid values. Instead of iterating over
|
||||||
## `paramCount() <#paramCount>`_ with this proc you can call the
|
## `paramCount() <#paramCount>`_ with this proc you can call the
|
||||||
## convenience `commandLineParams() <#commandLineParams>`_.
|
## convenience `commandLineParams() <#commandLineParams>`_.
|
||||||
|
|
@ -1467,7 +1467,8 @@ elif defined(windows):
|
||||||
tags: [ReadIOEffect].} =
|
tags: [ReadIOEffect].} =
|
||||||
# Docstring in nimdoc block.
|
# Docstring in nimdoc block.
|
||||||
if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLine())
|
if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLine())
|
||||||
return TaintedString(ownArgv[i])
|
if i < cmdCount and i >= 0: return TaintedString(ownArgv[i])
|
||||||
|
raise newException(IndexError, "invalid index")
|
||||||
|
|
||||||
elif not defined(createNimRtl) and
|
elif not defined(createNimRtl) and
|
||||||
not(defined(posix) and appType == "lib") and
|
not(defined(posix) and appType == "lib") and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue