diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-09-24 13:15:46 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-09-24 13:15:55 +0200 |
commit | c1aecb8914b7e14089a3ae817e57ed53bcbba8f2 (patch) | |
tree | 0edd115bea737ac66437493db1e95cc9a5380423 /lib/pure | |
parent | 68bc45701a0a2a07dd03df339d08fd73694a9d25 (diff) | |
download | Nim-c1aecb8914b7e14089a3ae817e57ed53bcbba8f2.tar.gz |
os.nim: allow walkDir to work on hierarchies with dangling symbolic links; refs #9034
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/os.nim | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 2b3cf5142..91d4f0f9d 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -802,20 +802,16 @@ type pcDir, ## path refers to a directory pcLinkToDir ## path refers to a symbolic link to a directory - when defined(posix): proc getSymlinkFileKind(path: string): PathComponent = # Helper function. var s: Stat assert(path != "") - if stat(path, s) < 0'i32: - raiseOSError(osLastError()) - if S_ISDIR(s.st_mode): + if stat(path, s) == 0'i32 and S_ISDIR(s.st_mode): result = pcLinkToDir else: result = pcLinkToFile - proc staticWalkDir(dir: string; relative: bool): seq[ tuple[kind: PathComponent, path: string]] = discard |