From 46dffbed7127dfce862ab39ab4a501aca51f6ddc Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sat, 8 Jul 2017 21:48:03 +0200 Subject: minor improvements to os.paramStr --- lib/pure/os.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/pure/os.nim') diff --git a/lib/pure/os.nim b/lib/pure/os.nim index b4cbd200c..880d60d4f 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1429,7 +1429,7 @@ when defined(nimdoc): proc paramStr*(i: int): TaintedString {.tags: [ReadIOEffect].} = ## 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 ## `paramCount() <#paramCount>`_ with this proc you can call the ## convenience `commandLineParams() <#commandLineParams>`_. @@ -1467,7 +1467,8 @@ elif defined(windows): tags: [ReadIOEffect].} = # Docstring in nimdoc block. 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 not(defined(posix) and appType == "lib") and -- cgit 1.4.1-2-gfad0 ying.txt?h=devel&id=658b28dc5707601b39d9aad4b6bf79a9afff1e92'>blame commit diff stats
path: root/copying.txt
blob: 60b6a02170ad14a1c8fcf424c7e289111bba31ea (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11