From 620229508b2ee039d286cce54c9c7396b12edf43 Mon Sep 17 00:00:00 2001 From: longpanda Date: Tue, 19 Apr 2022 15:34:31 +0800 Subject: [PATCH] Show the directory path in the return menu for TreeView mode and Browser mode. --- .../grub-2.04/grub-core/ventoy/ventoy_browser.c | 8 ++++---- .../grub-2.04/grub-core/ventoy/ventoy_cmd.c | 16 ++++++++-------- .../grub-2.04/grub-core/ventoy/ventoy_def.h | 4 ++-- GRUB2/MOD_SRC/grub-2.04/install.sh | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c index 01c7248e..7b4cf966 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c @@ -520,13 +520,13 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a if (g_tree_view_menu_style == 0) { - browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n " - " echo 'return ...' \n}\n", "<--"); + browser_ssprintf(&mbuf, "menuentry \"%-10s [(%s)%s/..]\" --class=\"vtoyret\" VTOY_RET {\n " + " echo 'return ...' \n}\n", "<--", args[0], g_menu_path_buf); } else { - browser_ssprintf(&mbuf, "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n " - " echo 'return ...' \n}\n"); + browser_ssprintf(&mbuf, "menuentry \"[(%s)%s/..]\" --class=\"vtoyret\" VTOY_RET {\n " + " echo 'return ...' \n}\n", args[0], g_menu_path_buf); } for (i = 1; i >= 0; i--) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c index 7e4ffc04..711c3fdd 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c @@ -2295,8 +2295,8 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "menuentry \"[Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n " - " echo '%s ...' \n" - "}\n", "return"); + " echo 'return ...' \n" + "}\n"); } } @@ -2350,16 +2350,16 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) if (g_tree_view_menu_style == 0) { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n " + "menuentry \"%-10s [%s/..]\" --class=\"vtoyret\" VTOY_RET {\n " " echo 'return ...' \n" - "}\n", "<--"); + "}\n", "<--", node->dir); } else { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n " - " echo '%s ...' \n" - "}\n", "return"); + "menuentry \"[%s/..]\" --class=\"vtoyret\" VTOY_RET {\n " + " echo 'return ...' \n" + "}\n", node->dir); } } @@ -2397,7 +2397,7 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) if (node != &g_img_iterator_head) { - vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "%s", "}\n"); + vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "}\n"); } node->done = 1; diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h index f5767080..5f90ba7a 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h @@ -313,8 +313,8 @@ extern int g_ventoy_debug; void ventoy_debug(const char *fmt, ...); #define debug(fmt, args...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, ##args) -#define vtoy_ssprintf(buf, pos, fmt, ...) \ - pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__) +#define vtoy_ssprintf(buf, pos, fmt, args...) \ + pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, ##args) #define browser_ssprintf(mbuf, fmt, args...) \ (mbuf)->pos += grub_snprintf((mbuf)->buf + (mbuf)->pos, (mbuf)->max - (mbuf)->pos, fmt, ##args) diff --git a/GRUB2/MOD_SRC/grub-2.04/install.sh b/GRUB2/MOD_SRC/grub-2.04/install.sh index 35830c26..c95ca4c7 100644 --- a/GRUB2/MOD_SRC/grub-2.04/install.sh +++ b/GRUB2/MOD_SRC/grub-2.04/install.sh @@ -9,7 +9,7 @@ mkdir -p $VT_DIR/GRUB2/PXE make install -PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/ +PATH=$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/:$PATH net_modules_legacy="net tftp http" all_modules_legacy="file setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios"