target_type should be either SCE_S_IFREG for files or SCE_S_IFDIR for directories
| 167 | |
| 168 | // target_type should be either SCE_S_IFREG for files or SCE_S_IFDIR for directories |
| 169 | int parse_dir_with_callback(int target_type, const char* path, void(*callback)(void*, const char*, const char*), void* data) |
| 170 | { |
| 171 | SceUID dfd = sceIoDopen(path); |
| 172 | if (dfd >= 0) { |
| 173 | int res = 0; |
| 174 | |
| 175 | do { |
| 176 | SceIoDirent dir; |
| 177 | memset(&dir, 0, sizeof(SceIoDirent)); |
| 178 | |
| 179 | res = sceIoDread(dfd, &dir); |
| 180 | if (res > 0) { |
| 181 | if ((dir.d_stat.st_mode & SCE_S_IFMT) == target_type) { |
| 182 | callback(data, path, dir.d_name); |
| 183 | if (cancelHandler()) { |
| 184 | closeWaitDialog(); |
| 185 | setDialogStep(DIALOG_STEP_CANCELED); |
| 186 | return -1; |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } while (res > 0); |
| 191 | sceIoDclose(dfd); |
| 192 | } |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | typedef struct { |
| 197 | int refresh_pass; |
no test coverage detected