char * _PR_MD_READ_DIR(_MDDir *d, PRIntn flags) { PRUword numFiles = 1; BOOL rv; char *fileName; USHORT fileAttr; if ( d ) { while (1) { if (d->firstEntry) { d->firstEntry = PR_FALSE; rv = NO_ERROR; } else { rv = DosFindNext(d->d_hdl, &(d->d_entry), sizeof(d->d_entry), &numFiles); } if (rv != NO_ERROR) { break; } fileName = GetFileFromDIR(d); fileAttr = GetFileAttr(d); if ( (flags & PR_SKIP_DOT) && (fileName[0] == '.') && (fileName[1] == '\0')) continue; if ( (flags & PR_SKIP_DOT_DOT) && (fileName[0] == '.') && (fileName[1] == '.') && (fileName[2] == '\0')) continue; /* * XXX * Is this the correct definition of a hidden file on OS/2? */ if ((flags & PR_SKIP_NONE) && (fileAttr & FILE_HIDDEN)) return fileName; else if ((flags & PR_SKIP_HIDDEN) && (fileAttr & FILE_HIDDEN)) continue; return fileName; } PR_ASSERT(NO_ERROR != rv); _PR_MD_MAP_READDIR_ERROR(rv); return NULL; } PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return NULL; }
PRUnichar * _PR_MD_READ_DIR_UTF16(_MDDirUTF16 *d, PRIntn flags) { PRInt32 err; BOOL rv; PRUnichar *fileName; if (!findNextFileW) { PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); return NULL; } if ( d ) { while (1) { if (d->firstEntry) { d->firstEntry = PR_FALSE; rv = 1; } else { rv = findNextFileW(d->d_hdl, &(d->d_entry)); } if (rv == 0) { break; } fileName = GetFileFromDIR(d); if ( (flags & PR_SKIP_DOT) && (fileName[0] == L'.') && (fileName[1] == L'\0')) continue; if ( (flags & PR_SKIP_DOT_DOT) && (fileName[0] == L'.') && (fileName[1] == L'.') && (fileName[2] == L'\0')) continue; if ( (flags & PR_SKIP_HIDDEN) && FileIsHidden(d)) continue; return fileName; } err = GetLastError(); PR_ASSERT(NO_ERROR != err); _PR_MD_MAP_READDIR_ERROR(err); return NULL; } PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return NULL; }