diff options
-rw-r--r-- | Library/UefiShellUfmCommandLib/panel.c | 32 | ||||
-rw-r--r-- | Library/UefiShellUfmCommandLib/panel.h | 10 |
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 */ |