rendered paste body final void toList (void delegate (char[], char[], bool) dg)
{
DIR* dir;
stat_t st;
dirent* entry;
char[] prefix;
dir = tango.stdc.posix.dirent.opendir (this.cString.ptr);
if (! dir)
exception;
scope (exit)
tango.stdc.posix.dirent.closedir (dir);
prefix = FilePath.padded (this.toUtf8);
while ((entry = tango.stdc.posix.dirent.readdir(dir)) != null)
{
// ensure we include the terminating null ...
auto len = tango.stdc.string.strlen (entry.d_name.ptr);
auto str = entry.d_name.ptr [0 .. len];
if (stat(entry.d_name.ptr, &st) != 0) {
exception; // file probably doesn't exist -- check errorno;
}
//dg (prefix, str, (entry.d_type & DT_DIR) != 0);
if (S_ISDIR(st.st_mode)) {
printf("true: %s\n",entry.d_name.ptr);
}
else {
printf("false: %s\n",entry.d_name.ptr);
}
dg (prefix, str, S_ISDIR(st.st_mode) );
}
}
}