diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-04-18 01:07:21 +0200 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-04-18 01:07:21 +0200 |
commit | 8d1f7869ae6ad5bdba75a737ea9eec4482956866 (patch) | |
tree | 0c76811688f0379f538111037927f8a8e98cdf12 /lib | |
parent | 497815ee814b030a93a5d127535693f7b1404e2a (diff) | |
download | Nim-8d1f7869ae6ad5bdba75a737ea9eec4482956866.tar.gz |
Adds to docstrings link between removeFile and removeDir.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/os.nim | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 408fbd9d4..433a79c5e 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -794,8 +794,11 @@ when not defined(ENOENT): var ENOENT {.importc, header: "<errno.h>".}: cint proc removeFile*(file: string) {.rtl, extern: "nos$1", tags: [FWriteDir].} = - ## Removes the `file`. If this fails, `EOS` is raised. This does not fail - ## if the file never existed in the first place. + ## Removes the `file`. + ## + ## If this fails, `EOS` is raised. This does not fail if the file never + ## existed in the first place. Despite the name of this proc you can also + ## call it on directories, but they will only be removed if they are empty. if cremove(file) != 0'i32 and errno != ENOENT: OSError() proc execShellCmd*(command: string): int {.rtl, extern: "nos$1", @@ -1076,8 +1079,12 @@ proc rawRemoveDir(dir: string) = proc removeDir*(dir: string) {.rtl, extern: "nos$1", tags: [ FWriteDir, FReadDir].} = ## Removes the directory `dir` including all subdirectories and files - ## in `dir` (recursively). If this fails, `EOS` is raised. This does not fail - ## if the directory never existed in the first place. + ## in `dir` (recursively). + ## + ## If this fails, `EOS` is raised. This does not fail if the directory never + ## existed in the first place. If you need non recursive directory removal + ## which fails when the directory contains files use the `removeFile` proc + ## instead. for kind, path in walkDir(dir): case kind of pcFile, pcLinkToFile, pcLinkToDir: removeFile(path) |