aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-12-12 15:45:42 +0300
committerJoursoir <chat@joursoir.net>2021-12-12 15:49:50 +0300
commit635f388460372d954026fe0d71d64f6460ecab43 (patch)
tree21a2d962aaf28002ff77bbd5b4de9b920bac1040
parentf53d57392a240abbea84905e28683576d2e696df (diff)
downloadufm-635f388460372d954026fe0d71d64f6460ecab43.tar.gz
ufm-635f388460372d954026fe0d71d64f6460ecab43.tar.bz2
ufm-635f388460372d954026fe0d71d64f6460ecab43.zip
actions: make frontend creation of directory
-rw-r--r--Library/UefiShellUfmCommandLib/actions.c34
-rw-r--r--Library/UefiShellUfmCommandLib/actions.h1
2 files changed, 35 insertions, 0 deletions
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);
diff --git a/Library/UefiShellUfmCommandLib/actions.h b/Library/UefiShellUfmCommandLib/actions.h
index c6a7031..57e967c 100644
--- a/Library/UefiShellUfmCommandLib/actions.h
+++ b/Library/UefiShellUfmCommandLib/actions.h
@@ -24,6 +24,7 @@ BOOLEAN execute(VOID);
BOOLEAN mark(VOID);
BOOLEAN edit(VOID);
BOOLEAN hexedit(VOID);
+BOOLEAN mkdir(VOID);
BOOLEAN show_filesystems(VOID);
BOOLEAN do_nothing(VOID);
BOOLEAN quit(VOID);