| 493 | } |
| 494 | |
| 495 | int exportPath(char *path, uint32_t *songs, uint32_t *videos, uint32_t *pictures, FileProcessParam *param) { |
| 496 | SceUID dfd = sceIoDopen(path); |
| 497 | if (dfd >= 0) { |
| 498 | int res = 0; |
| 499 | |
| 500 | do { |
| 501 | SceIoDirent dir; |
| 502 | memset(&dir, 0, sizeof(SceIoDirent)); |
| 503 | |
| 504 | res = sceIoDread(dfd, &dir); |
| 505 | if (res > 0) { |
| 506 | char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2); |
| 507 | snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name); |
| 508 | |
| 509 | if (SCE_S_ISDIR(dir.d_stat.st_mode)) { |
| 510 | int ret = exportPath(new_path, songs, videos, pictures, param); |
| 511 | if (ret <= 0) { |
| 512 | free(new_path); |
| 513 | sceIoDclose(dfd); |
| 514 | return ret; |
| 515 | } |
| 516 | } else { |
| 517 | if (mediaPathHandler(new_path)) { |
| 518 | free(new_path); |
| 519 | continue; |
| 520 | } |
| 521 | |
| 522 | int ret = exportMedia(new_path, songs, videos, pictures, param); |
| 523 | if (ret <= 0) { |
| 524 | free(new_path); |
| 525 | sceIoDclose(dfd); |
| 526 | return ret; |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | free(new_path); |
| 531 | } |
| 532 | } while (res > 0); |
| 533 | |
| 534 | sceIoDclose(dfd); |
| 535 | } else { |
| 536 | if (mediaPathHandler(path)) |
| 537 | return 1; |
| 538 | |
| 539 | int ret = exportMedia(path, songs, videos, pictures, param); |
| 540 | if (ret <= 0) |
| 541 | return ret; |
| 542 | } |
| 543 | |
| 544 | return 1; |
| 545 | } |
| 546 | |
| 547 | int export_thread(SceSize args_size, ExportArguments *args) { |
| 548 | SceUID thid = -1; |
no test coverage detected