MCPcopy Create free account
hub / github.com/TheOfficialFloW/VitaShell / parse_dir_with_callback

Function parse_dir_with_callback

refresh.c:169–194  ·  view source on GitHub ↗

target_type should be either SCE_S_IFREG for files or SCE_S_IFDIR for directories

Source from the content-addressed store, hash-verified

167
168// target_type should be either SCE_S_IFREG for files or SCE_S_IFDIR for directories
169int 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
196typedef struct {
197 int refresh_pass;

Callers 4

dlc_callback_outerFunction · 0.85
refresh_threadFunction · 0.85
license_dir_callbackFunction · 0.85
license_threadFunction · 0.85

Calls 3

cancelHandlerFunction · 0.85
closeWaitDialogFunction · 0.85
setDialogStepFunction · 0.85

Tested by

no test coverage detected