summary refs log tree commit diff stats
path: root/lib/posix
diff options
context:
space:
mode:
authorEugene Kabanov <ka@hardcore.kiev.ua>2017-03-29 09:34:07 +0300
committerAndreas Rumpf <rumpf_a@web.de>2017-03-29 08:34:07 +0200
commit977758fe062a51f6d6dc2be227688ddfa768c680 (patch)
treeae44801e2474451c160e8638d0c5ab89a33413c9 /lib/posix
parent3fc75b2ca411a49c9b61a8b023eb167fa452e353 (diff)
downloadNim-977758fe062a51f6d6dc2be227688ddfa768c680.tar.gz
Fix posix.nim `dirent` structure to be more compatible with OSes. (#5623)
Diffstat (limited to 'lib/posix')
-rw-r--r--lib/posix/posix.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index a18db2150..b29f43eb4 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -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,