summary refs log tree commit diff stats
path: root/lib/std
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-10-02 02:14:10 +0800
committerGitHub <noreply@github.com>2021-10-01 20:14:10 +0200
commit7577ea9e4ce4d9966edc1f1cc27bde1b2ec9f369 (patch)
tree9ddbdbb54a48649be9a366dc9f27e3c8a8599d9a /lib/std
parent2aeac26f088c5170f7f0c4d8e73d099a32e8895a (diff)
downloadNim-7577ea9e4ce4d9966edc1f1cc27bde1b2ec9f369.tar.gz
[std/tempfiles] docs improvement (#18936)
* unify comments

* more
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/tempfiles.nim11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/std/tempfiles.nim b/lib/std/tempfiles.nim
index 26786d463..ce84c2a37 100644
--- a/lib/std/tempfiles.nim
+++ b/lib/std/tempfiles.nim
@@ -122,23 +122,24 @@ proc getTempDirImpl(dir: string): string {.inline.} =
 proc genTempPath*(prefix, suffix: string, dir = ""): string =
   ## Generates a path name in `dir`.
   ##
-  ## If `dir` is empty, (`getTempDir <os.html#getTempDir>`_) will be used.
   ## The path begins with `prefix` and ends with `suffix`.
+  ##
+  ## .. note:: `dir` must exist (empty `dir` will resolve to `getTempDir <os.html#getTempDir>`_).
   let dir = getTempDirImpl(dir)
   result = dir / (prefix & randomPathName(nimTempPathLength) & suffix)
 
 proc createTempFile*(prefix, suffix: string, dir = ""): tuple[cfile: File, path: string] =
   ## Creates a new temporary file in the directory `dir`.
-  ## 
+  ##
   ## This generates a path name using `genTempPath(prefix, suffix, dir)` and
   ## returns a file handle to an open file and the path of that file, possibly after
   ## retrying to ensure it doesn't already exist.
-  ## 
+  ##
   ## If failing to create a temporary file, `OSError` will be raised.
   ##
   ## .. note:: It is the caller's responsibility to close `result.cfile` and
   ##    remove `result.file` when no longer needed.
-  ## .. note:: `dir` must exist (empty `dir` will resolve to `getTempDir()`).
+  ## .. note:: `dir` must exist (empty `dir` will resolve to `getTempDir <os.html#getTempDir>`_).
   runnableExamples:
     import std/os
     doAssertRaises(OSError): discard createTempFile("", "", "nonexistent")
@@ -170,7 +171,7 @@ proc createTempDir*(prefix, suffix: string, dir = ""): string =
   ## If failing to create a temporary directory, `OSError` will be raised.
   ##
   ## .. note:: It is the caller's responsibility to remove the directory when no longer needed.
-  ## .. note:: `dir` must exist (empty `dir` will resolve to `getTempDir()`).
+  ## .. note:: `dir` must exist (empty `dir` will resolve to `getTempDir <os.html#getTempDir>`_).
   runnableExamples:
     import std/os
     doAssertRaises(OSError): discard createTempDir("", "", "nonexistent")