change os.nim doc links to new style (#19102)

This commit is contained in:
Andrey Makarov 2021-11-08 15:10:01 +03:00 • committed by GitHub
commit b21eb1ed36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 345 additions and 321 deletions

View file

@ -56,13 +56,13 @@ when not defined(nimscript):
##
## If the variable does not exist, `""` is returned. To distinguish
## whether a variable exists or it's value is just `""`, call
## `existsEnv(key) proc <#existsEnv,string>`_.
## `existsEnv(key) proc`_.
##
## See also:
## * `existsEnv proc <#existsEnv,string>`_
## * `putEnv proc <#putEnv,string,string>`_
## * `delEnv proc <#delEnv,string>`_
## * `envPairs iterator <#envPairs.i>`_
## * `existsEnv proc`_
## * `putEnv proc`_
## * `delEnv proc`_
## * `envPairs iterator`_
runnableExamples:
assert getEnv("unknownEnv") == ""
assert getEnv("unknownEnv", "doesn't exist") == "doesn't exist"
@ -76,10 +76,10 @@ when not defined(nimscript):
## Returns true if it exists, false otherwise.
##
## See also:
## * `getEnv proc <#getEnv,string,string>`_
## * `putEnv proc <#putEnv,string,string>`_
## * `delEnv proc <#delEnv,string>`_
## * `envPairs iterator <#envPairs.i>`_
## * `getEnv proc`_
## * `putEnv proc`_
## * `delEnv proc`_
## * `envPairs iterator`_
runnableExamples:
assert not existsEnv("unknownEnv")
@ -90,10 +90,10 @@ when not defined(nimscript):
## If an error occurs, `OSError` is raised.
##
## See also:
## * `getEnv proc <#getEnv,string,string>`_
## * `existsEnv proc <#existsEnv,string>`_
## * `delEnv proc <#delEnv,string>`_
## * `envPairs iterator <#envPairs.i>`_
## * `getEnv proc`_
## * `existsEnv proc`_
## * `delEnv proc`_
## * `envPairs iterator`_
when defined(windows):
if key.len == 0 or '=' in key:
raise newException(OSError, "invalid key, got: " & $(key, val))
@ -108,10 +108,10 @@ when not defined(nimscript):
## If an error occurs, `OSError` is raised.
##
## See also:ven
## * `getEnv proc <#getEnv,string,string>`_
## * `existsEnv proc <#existsEnv,string>`_
## * `putEnv proc <#putEnv,string,string>`_
## * `envPairs iterator <#envPairs.i>`_
## * `getEnv proc`_
## * `existsEnv proc`_
## * `putEnv proc`_
## * `envPairs iterator`_
template bail = raiseOSError(osLastError(), key)
when defined(windows):
#[
@ -190,10 +190,10 @@ iterator envPairs*(): tuple[key, value: string] {.tags: [ReadEnvEffect].} =
## in the second its value.
##
## Works in native backends, nodejs and vm, like the following APIs:
## * `getEnv proc <#getEnv,string,string>`_
## * `existsEnv proc <#existsEnv,string>`_
## * `putEnv proc <#putEnv,string,string>`_
## * `delEnv proc <#delEnv,string>`_
## * `getEnv proc`_
## * `existsEnv proc`_
## * `putEnv proc`_
## * `delEnv proc`_
when nimvm:
for ai in envPairsImplSeq(): yield ai
else:

View file

@ -18,7 +18,7 @@ proc `$`*(err: OSErrorCode): string {.borrow.}
proc osErrorMsg*(errorCode: OSErrorCode): string =
## Converts an OS error code into a human readable string.
##
## The error code can be retrieved using the `osLastError proc <#osLastError>`_.
## The error code can be retrieved using the `osLastError proc`_.
##
## If conversion fails, or `errorCode` is `0` then `""` will be
## returned.
@ -28,8 +28,8 @@ proc osErrorMsg*(errorCode: OSErrorCode): string =
## message.
##
## See also:
## * `raiseOSError proc <#raiseOSError,OSErrorCode,string>`_
## * `osLastError proc <#osLastError>`_
## * `raiseOSError proc`_
## * `osLastError proc`_
runnableExamples:
when defined(linux):
assert osErrorMsg(OSErrorCode(0)) == ""
@ -63,18 +63,17 @@ proc newOSError*(
## Creates a new `OSError exception <system.html#OSError>`_.
##
## The `errorCode` will determine the
## message, `osErrorMsg proc <#osErrorMsg,OSErrorCode>`_ will be used
## message, `osErrorMsg proc`_ will be used
## to get this message.
##
## The error code can be retrieved using the `osLastError proc
## <#osLastError>`_.
## The error code can be retrieved using the `osLastError proc`_.
##
## If the error code is `0` or an error message could not be retrieved,
## the message `unknown OS error` will be used.
##
## See also:
## * `osErrorMsg proc <#osErrorMsg,OSErrorCode>`_
## * `osLastError proc <#osLastError>`_
## * `osErrorMsg proc`_
## * `osLastError proc`_
var e: owned(ref OSError); new(e)
e.errorCode = errorCode.int32
e.msg = osErrorMsg(errorCode)
@ -90,7 +89,7 @@ proc newOSError*(
proc raiseOSError*(errorCode: OSErrorCode, additionalInfo = "") {.noinline.} =
## Raises an `OSError exception <system.html#OSError>`_.
##
## Read the description of the `newOSError proc <#newOSError,OSErrorCode,string>`_ to learn
## Read the description of the `newOSError proc`_ to learn
## how the exception object is created.
raise newOSError(errorCode, additionalInfo)
@ -109,8 +108,8 @@ proc osLastError*(): OSErrorCode {.sideEffect.} =
## immediately after an OS call fails. On POSIX systems this is not a problem.
##
## See also:
## * `osErrorMsg proc <#osErrorMsg,OSErrorCode>`_
## * `raiseOSError proc <#raiseOSError,OSErrorCode,string>`_
## * `osErrorMsg proc`_
## * `raiseOSError proc`_
when defined(nimscript):
discard
elif defined(windows):

View file

@ -37,9 +37,9 @@ const
when doslikeFileSystem: '/'
else: DirSep
## An alternative character used by the operating system to separate
## pathname components, or the same as `DirSep <#DirSep>`_ if only one separator
## pathname components, or the same as DirSep_ if only one separator
## character exists. This is set to `'/'` on Windows systems
## where `DirSep <#DirSep>`_ is a backslash (`'\\'`).
## where DirSep_ is a backslash (`'\\'`).
PathSep* =
when defined(macos) or defined(RISCOS): ','
@ -55,7 +55,7 @@ const
defined(PalmOS) or defined(MorphOS): false
else: true
## True if the file system is case sensitive, false otherwise. Used by
## `cmpPaths proc <#cmpPaths,string,string>`_ to compare filenames properly.
## `cmpPaths proc`_ to compare filenames properly.
ExeExt* =
when doslikeFileSystem: "exe"

File diff suppressed because it is too large Load diff