]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
priority key>parent in menu class plugin
authorlongpanda <admin@ventoy.net>
Mon, 31 May 2021 12:46:45 +0000 (20:46 +0800)
committerlongpanda <admin@ventoy.net>
Mon, 31 May 2021 12:46:45 +0000 (20:46 +0800)
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c

index fc56936f53c5947f7bfd28db559bdb13100ab3a8..8b3ecd7fce4f1bed6d8e83794c8e3fd2119346fa 100644 (file)
@@ -2488,16 +2488,25 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
                 continue;
             }
 
                 continue;
             }
 
-            if (node->parent)
+            if (node->parent == 0)
             {
             {
-                if ((node->patlen < pathlen) && ventoy_plugin_is_parent(node->pattern, node->patlen, path))
+                if ((node->patlen < namelen) && grub_strstr(name, node->pattern))
                 {
                     return node->class;
                 }
             }
                 {
                     return node->class;
                 }
             }
-            else
+        }
+        
+        for (node = g_menu_class_head; node; node = node->next)
+        {
+            if (node->type != type)
             {
             {
-                if ((node->patlen < namelen) && grub_strstr(name, node->pattern))
+                continue;
+            }
+
+            if (node->parent)
+            {
+                if ((node->patlen < pathlen) && ventoy_plugin_is_parent(node->pattern, node->patlen, path))
                 {
                     return node->class;
                 }
                 {
                     return node->class;
                 }