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

Function fileListGetDeviceEntries

file.c:951–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949}
950
951int fileListGetDeviceEntries(FileList *list) {
952 if (!list)
953 return VITASHELL_ERROR_ILLEGAL_ADDR;
954
955 int i;
956 for (i = 0; i < N_DEVICES; i++) {
957 if (devices[i]) {
958 if (is_safe_mode && strcmp(devices[i], "ux0:") != 0)
959 continue;
960
961 SceIoStat stat;
962 memset(&stat, 0, sizeof(SceIoStat));
963 if (sceIoGetstat(devices[i], &stat) >= 0) {
964 FileListEntry *entry = malloc(sizeof(FileListEntry));
965 if (entry) {
966 entry->name_length = strlen(devices[i]);
967 entry->name = malloc(entry->name_length + 1);
968 strcpy(entry->name, devices[i]);
969 entry->is_folder = 1;
970 entry->type = FILE_TYPE_UNKNOWN;
971 entry->is_symlink = 0;
972
973 SceIoDevInfo info;
974 memset(&info, 0, sizeof(SceIoDevInfo));
975 int res = sceIoDevctl(entry->name, 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo));
976 if (res >= 0) {
977 entry->size = info.free_size;
978 entry->size2 = info.max_size;
979 } else {
980 if (strcmp(devices[i], "ux0:") == 0) {
981 sceAppMgrGetDevInfo("ux0:", (uint64_t *)&entry->size2, (uint64_t *)&entry->size);
982 } else {
983 entry->size = 0;
984 entry->size2 = 0;
985 }
986 }
987
988 memcpy(&entry->ctime, (SceDateTime *) &stat.st_ctime, sizeof(SceDateTime));
989 memcpy(&entry->mtime, (SceDateTime *) &stat.st_mtime, sizeof(SceDateTime));
990 memcpy(&entry->atime, (SceDateTime *) &stat.st_atime, sizeof(SceDateTime));
991
992 fileListAddEntry(list, entry, SORT_BY_NAME);
993
994 list->folders++;
995 }
996 }
997 }
998 }
999
1000 return 0;
1001}
1002
1003int fileListGetDirectoryEntries(FileList *list, const char *path, int sort) {
1004 if (!list)

Callers 1

fileListGetEntriesFunction · 0.85

Calls 1

fileListAddEntryFunction · 0.85

Tested by

no test coverage detected