ui/ncurses: Use pmenu_item destrutor to free ncurses ITEMs
[petitboot] / discover / grub2 / builtins.c
index 75110760082ec51324f685e5c5b84bebac5e5745..6ada2a64c130ae05c66c12c15753e84e0af684e2 100644 (file)
@@ -154,6 +154,15 @@ static bool builtin_test_op_file(struct grub2_script *script, char op,
        return result;
 }
 
+static bool builtin_test_op_dir(struct grub2_script *script, char op,
+               const char *dir)
+{
+       if (op != 'd')
+               return false;
+
+       return parser_check_dir(script->ctx, script->ctx->device, dir) == 0;
+}
+
 static bool builtin_test_op(struct grub2_script *script,
                int argc, char **argv, int *consumed)
 {
@@ -207,6 +216,11 @@ static bool builtin_test_op(struct grub2_script *script,
                        *consumed = 2;
                        return builtin_test_op_file(script, op[1], a1);
                }
+
+               if (!strcmp(op, "-d")) {
+                       *consumed = 2;
+                       return builtin_test_op_dir(script, op[1], a1);
+               }
        }
 
        op = argv[0];