Fixed the boot issue for "StorageCraft Recovery Environment CrossPlatform" in UEFI mode.

This commit is contained in:
longpanda 2021-08-02 22:50:38 +08:00
parent e2656c287b
commit 6c113880e5

View File

@ -333,7 +333,9 @@ end:
static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName) static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
{ {
int i = 0; int i = 0;
int len = 0;
int dollar = 0; int dollar = 0;
int quotation = 0;
grub_file_t file = NULL; grub_file_t file = NULL;
char *buf = NULL; char *buf = NULL;
char *start = NULL; char *start = NULL;
@ -382,6 +384,12 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
start++; start++;
} }
if (*start == '"')
{
quotation = 1;
start++;
}
while (*start) while (*start)
{ {
img = grub_zalloc(sizeof(initrd_info)); img = grub_zalloc(sizeof(initrd_info));
@ -400,6 +408,16 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
} }
} }
if (quotation)
{
len = (int)grub_strlen(img->name);
if (len > 2 && img->name[len - 1] == '"')
{
img->name[len - 1] = 0;
}
debug("Remove quotation <%s>\n", img->name);
}
if (dollar == 1 || ventoy_find_initrd_by_name(g_initrd_img_list, img->name)) if (dollar == 1 || ventoy_find_initrd_by_name(g_initrd_img_list, img->name))
{ {
grub_free(img); grub_free(img);