mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
os.nim: allow walkDir to work on hierarchies with dangling symbolic links; refs #9034
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user