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

Function mediaPathHandler

io_process.c:374–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374static int mediaPathHandler(const char *path) {
375 // Avoid export-ception
376 if (strncasecmp(path, "ux0:music/", 10) == 0 ||
377 strncasecmp(path, "ux0:video/", 10) == 0 ||
378 strncasecmp(path, "ux0:picture/", 12) == 0) {
379 return 1;
380 }
381
382 // The files allowed
383 int type = getFileType(path);
384 switch (type) {
385 case FILE_TYPE_BMP:
386 case FILE_TYPE_JPEG:
387 case FILE_TYPE_PNG:
388 case FILE_TYPE_MP3:
389 case FILE_TYPE_MP4:
390 return 0;
391 }
392
393 // Folders are allowed too
394 SceIoStat stat;
395 memset(&stat, 0, sizeof(SceIoStat));
396 if (sceIoGetstat(path, &stat) >= 0 && SCE_S_ISDIR(stat.st_mode)) {
397 return 0;
398 }
399
400 // Ignore the rest
401 return 1;
402}
403
404static void musicExportProgress(void *data, int progress) {
405 uint32_t *args = (uint32_t *)data;

Callers 1

exportPathFunction · 0.85

Calls 1

getFileTypeFunction · 0.85

Tested by

no test coverage detected