This is fairly simple, and I have 1 way of doing it, but I don't like it and I feel that there should be an easier way but I can't find it This is my (pseudo)code:
It feels like the if/else should be eliminated, replaced by just one check of some sort, but I can't see how. Does anybody else have any ideas?Code:void getDirList(bool wantDirectory, (...)) { (...) do { if(wantDirectory) { if(fileData.attributes & FILE_ATTRIBUTE_DIRECTORY) add the filename; } else { if(!(fileData.attributes & FILE_ATTRIBUTE_DIRECTORY)) add the filename; } }while(there's still more files) }