From 635f388460372d954026fe0d71d64f6460ecab43 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Sun, 12 Dec 2021 15:45:42 +0300 Subject: actions: make frontend creation of directory --- Library/UefiShellUfmCommandLib/actions.c | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'Library/UefiShellUfmCommandLib/actions.c') diff --git a/Library/UefiShellUfmCommandLib/actions.c b/Library/UefiShellUfmCommandLib/actions.c index ac869e6..174eb3e 100644 --- a/Library/UefiShellUfmCommandLib/actions.c +++ b/Library/UefiShellUfmCommandLib/actions.c @@ -9,8 +9,10 @@ #include "menu-bar.h" #include "command-bar.h" +#include "dialog-box.h" #include "panel.h" #include "filemanager.h" +#include "cmds.h" #include "actions.h" #define MENUBAR (fm_ctx.menubar) @@ -19,6 +21,9 @@ #define LEFT_PANEL (fm_ctx.left) #define RIGHT_PANEL (fm_ctx.right) +STATIC CONST CHAR16 mkdir_title[] = L" Create a new directory "; +STATIC CONST CHAR16 mkdir_label[] = L"Enter directory name:"; + STATIC EFI_STATUS shell_exec2(CONST CHAR16 *farg, CONST CHAR16 *sarg, EFI_STATUS *cmd_status) { @@ -118,6 +123,35 @@ BOOLEAN hexedit(VOID) return TRUE; } +BOOLEAN mkdir(VOID) +{ + struct dbox_ctx *dbox; + UINTN line = PANEL->curline; + EFI_STATUS status; + BOOLEAN status_op; + + if(!PANEL->cwd) + return FALSE; + + dbox = dbox_alloc(fm_ctx.scr, mkdir_title, mkdir_label, TRUE, L""); + if(!dbox) + return FALSE; + + dbox_refresh(dbox); + status_op = dbox_handle(dbox); + if(status_op) { + status = make_directory(dbox->in->buffer); + if(status == EFI_SUCCESS) { + panel_cd_to(PANEL, PANEL->cwd); + panel_move_cursor(PANEL, line); + } + } + + redraw(); + dbox_release(dbox); + return TRUE; +} + BOOLEAN show_filesystems(VOID) { return panel_cd_to(PANEL, NULL); -- cgit v1.2.3-18-g5258