aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-11-30 17:52:13 +0300
committerJoursoir <chat@joursoir.net>2021-11-30 17:52:13 +0300
commitdcb8f1393ef299df31044593a2f1a178b18d7f4f (patch)
treed921290a07e0a31d4f630b8b87b37f43269a0fbc /Library/UefiShellUfmCommandLib
parent727390c04c56c60fbe4369d76565f5607d468e11 (diff)
downloadufm-dcb8f1393ef299df31044593a2f1a178b18d7f4f.tar.gz
ufm-dcb8f1393ef299df31044593a2f1a178b18d7f4f.tar.bz2
ufm-dcb8f1393ef299df31044593a2f1a178b18d7f4f.zip
panel: make panel_cd_to()
Diffstat (limited to 'Library/UefiShellUfmCommandLib')
-rw-r--r--Library/UefiShellUfmCommandLib/panel.c32
-rw-r--r--Library/UefiShellUfmCommandLib/panel.h10
2 files changed, 42 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/panel.c b/Library/UefiShellUfmCommandLib/panel.c
index c8d3565..c76fb55 100644
--- a/Library/UefiShellUfmCommandLib/panel.c
+++ b/Library/UefiShellUfmCommandLib/panel.c
@@ -305,3 +305,35 @@ BOOLEAN panel_move_cursor(struct panel_ctx *p, UINTN line)
return TRUE;
}
+BOOLEAN panel_cd_to(struct panel_ctx *p, CONST CHAR16 *path)
+{
+ struct fs_array *fsa = NULL;
+ struct dir_list *dirs = NULL;
+ ASSERT(p != NULL);
+
+ if(path) {
+ dirs = scandir(path, L"*", 0);
+ if(!dirs)
+ return FALSE;
+ }
+ else {
+ fsa = scanfs();
+ if(!fsa)
+ return FALSE;
+ }
+
+ set_cwd(p, path);
+ if(p->dirs)
+ dirl_release(p->dirs);
+ if(p->fsa)
+ fsa_release(p->fsa);
+ p->dirs = dirs;
+ p->fsa = fsa;
+ p->marked = 0;
+ p->start_entry = 0;
+
+ update_marked_info(p);
+ panel_move_cursor(p, 1);
+ return TRUE;
+}
+
diff --git a/Library/UefiShellUfmCommandLib/panel.h b/Library/UefiShellUfmCommandLib/panel.h
index 1d71258..908d260 100644
--- a/Library/UefiShellUfmCommandLib/panel.h
+++ b/Library/UefiShellUfmCommandLib/panel.h
@@ -60,4 +60,14 @@ VOID panel_release(struct panel_ctx *p);
*/
BOOLEAN panel_move_cursor(struct panel_ctx *p, UINTN line);
+/*
+ * Changes the working directory
+ *
+ * p: the panel on which to operate
+ * path: the pointer to path string
+ *
+ * return: FALSE upon failure and TRUE upon successful completion
+*/
+BOOLEAN panel_cd_to(struct panel_ctx *p, CONST CHAR16 *path);
+
#endif /* UFM_PANEL_H */