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

Function contextMenuMoreEnterCallback

main_context.c:1141–1258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139
1140
1141static int contextMenuMoreEnterCallback(int sel, void *context) {
1142 switch (sel) {
1143 case MENU_MORE_ENTRY_COMPRESS:
1144 {
1145 FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
1146 if (file_entry) {
1147 char path[MAX_NAME_LENGTH];
1148
1149 // On marked entry
1150 if (mark_list.length > 1 && fileListFindEntry(&mark_list, file_entry->name)) {
1151 int end_slash = removeEndSlash(file_list.path);
1152
1153 char *p = strrchr(file_list.path, '/');
1154 if (!p)
1155 p = strrchr(file_list.path, ':');
1156
1157 if (strlen(p + 1) > 0) {
1158 strcpy(path, p + 1);
1159 } else {
1160 strncpy(path, file_list.path, p - file_list.path);
1161 path[p - file_list.path] = '\0';
1162 }
1163
1164 if (end_slash)
1165 addEndSlash(file_list.path);
1166 } else {
1167 char *p = strrchr(file_entry->name, '.');
1168 if (!p)
1169 p = strrchr(file_entry->name, '/');
1170 if (!p)
1171 p = file_entry->name + strlen(file_entry->name);
1172
1173 strncpy(path, file_entry->name, p-file_entry->name);
1174 path[p - file_entry->name] = '\0';
1175 }
1176
1177 // Append .zip extension
1178 strcat(path, ".zip");
1179
1180 initImeDialog(language_container[ARCHIVE_NAME], path, MAX_NAME_LENGTH, SCE_IME_TYPE_BASIC_LATIN, 0, 0);
1181 setDialogStep(DIALOG_STEP_COMPRESS_NAME);
1182 }
1183
1184 break;
1185 }
1186
1187 case MENU_MORE_ENTRY_INSTALL_ALL:
1188 {
1189 // Empty install list
1190 fileListEmpty(&install_list);
1191
1192 FileListEntry *file_entry = file_list.head->next; // Ignore '..'
1193
1194 int i;
1195 for (i = 0; i < file_list.length - 1; i++) {
1196 char path[MAX_PATH_LENGTH];
1197 snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
1198

Callers

nothing calls this directly

Calls 11

fileListGetNthEntryFunction · 0.85
fileListFindEntryFunction · 0.85
removeEndSlashFunction · 0.85
addEndSlashFunction · 0.85
initImeDialogFunction · 0.85
setDialogStepFunction · 0.85
fileListEmptyFunction · 0.85
getFileTypeFunction · 0.85
fileListAddEntryFunction · 0.85
fileListCopyEntryFunction · 0.85
initMessageDialogFunction · 0.85

Tested by

no test coverage detected