         { $ DT_WHT  +whiteout+ }
     } at* [ drop +unknown+ ] unless ;
 
+! An easy way to return +unknown+ is to mount a .iso on OSX and
+! call directory-entries on the mount point.
+: dirent>file-type ( dirent -- type )
+    dup d_type>> dirent-type>file-type
+    dup +unknown+ = [
+        drop d_name>> utf8 alien>string file-info type>>
+    ] [
+        nip
+    ] if ;
+
 M: unix >directory-entry ( byte-array -- directory-entry )
     {
         [ d_name>> underlying>> utf8 alien>string ]
-        [ d_type>> dirent-type>file-type ]
+        [ dirent>file-type ]
     } cleave directory-entry boa ;
 
 M: unix (directory-entries) ( path -- seq )

    [ readdir_r 0 = [ errno 0 = [ (io-error) ] unless ] unless ] 2keep
    void* deref [ drop f ] unless ;

: dirent-type>file-type ( ch -- type )
    H{
        { $ DT_BLK  +block-device+ }
        { $ DT_CHR  +character-device+ }

    [ [ file-permissions ] dip swap set-file-permissions ] 2bi ;

: with-unix-directory ( path quot -- )
    dupd '[ _ _
        [ opendir dup [ (io-error) ] unless ] dip
        dupd curry swap '[ _ closedir io-error ] [ ] cleanup
    ] with-directory ; inline

HOOK: find-next-file os ( DIR* -- byte-array )

