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

Function contextMenuNewEnterCallback

main_context.c:1259–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1257 return CONTEXT_MENU_CLOSING;
1258}
1259static int contextMenuNewEnterCallback(int sel, void *context) {
1260 switch (sel) {
1261 case MENU_NEW_FILE: {
1262 char path[MAX_PATH_LENGTH];
1263 int count = 1;
1264 while (1) {
1265 if (count == 1) {
1266 snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path,
1267 language_container[NEW_FILE]);
1268 } else {
1269 snprintf(path, MAX_PATH_LENGTH, "%s%s (%d)", file_list.path,
1270 language_container[NEW_FILE], count);
1271 }
1272 if (!checkFileExist(path))
1273 break;
1274
1275 count++;
1276 }
1277 initImeDialog(language_container[NEW_FILE], path + strlen(file_list.path),
1278 MAX_NAME_LENGTH, SCE_IME_TYPE_BASIC_LATIN, 0, 0);
1279 setDialogStep(DIALOG_STEP_NEW_FILE);
1280 break;
1281 };
1282 case MENU_NEW_FOLDER: {
1283 // Find a new folder name
1284 char path[MAX_PATH_LENGTH];
1285
1286 int count = 1;
1287 while (1) {
1288 if (count == 1) {
1289 snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path,
1290 language_container[NEW_FOLDER]);
1291 } else {
1292 snprintf(path, MAX_PATH_LENGTH, "%s%s (%d)", file_list.path,
1293 language_container[NEW_FOLDER], count);
1294 }
1295
1296 if (!checkFolderExist(path))
1297 break;
1298
1299 count++;
1300 }
1301
1302 initImeDialog(language_container[NEW_FOLDER], path + strlen(file_list.path),
1303 MAX_NAME_LENGTH, SCE_IME_TYPE_BASIC_LATIN, 0, 0);
1304 setDialogStep(DIALOG_STEP_NEW_FOLDER);
1305 break;
1306 };
1307 case MENU_NEW_BOOKMARK: {
1308 FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
1309 if (file_entry) {
1310 snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
1311 char target[MAX_PATH_LENGTH];
1312 char name[MAX_PATH_LENGTH];
1313 strncpy(name, file_entry->name, MAX_PATH_LENGTH-1);
1314 name[MAX_PATH_LENGTH-1] = '\0';
1315 removeEndSlash(name);
1316 snprintf(target, MAX_PATH_LENGTH, "%s%s."SYMLINK_EXT, VITASHELL_BOOKMARKS_PATH, name);

Callers

nothing calls this directly

Calls 10

checkFileExistFunction · 0.85
initImeDialogFunction · 0.85
setDialogStepFunction · 0.85
checkFolderExistFunction · 0.85
fileListGetNthEntryFunction · 0.85
removeEndSlashFunction · 0.85
createSymLinkFunction · 0.85
errorDialogFunction · 0.85
infoDialogFunction · 0.85
refreshFileListFunction · 0.85

Tested by

no test coverage detected