Fix posix.nim dirent structure to be more compatible with OSes. (#5623)

This commit is contained in:
Eugene Kabanov
2017-03-29 09:34:07 +03:00
committed by Andreas Rumpf
parent 3fc75b2ca4
commit 977758fe06

View File

@@ -109,12 +109,17 @@ type
Dirent* {.importc: "struct dirent",
header: "<dirent.h>", final, pure.} = object ## dirent_t struct
d_ino*: Ino ## File serial number.
when defined(linux) or defined(macosx) or defined(bsd):
when defined(dragonfly):
# DragonflyBSD doesn't have `d_reclen` field.
d_type*: uint8
elif defined(linux) or defined(macosx) or defined(freebsd) or
defined(netbsd) or defined(openbsd):
d_reclen*: cshort ## Length of this record. (not POSIX)
d_type*: int8 ## Type of file; not supported by all filesystem types.
## (not POSIX)
when defined(linux) or defined(bsd):
when defined(linux) or defined(openbsd):
d_off*: Off ## Not an offset. Value that ``telldir()`` would return.
d_name*: array[0..255, char] ## Name of entry.
Tflock* {.importc: "struct flock", final, pure,