This makes it possible to use relative paths in the "file" component of
gfxmenu images. I've tested that it works, but I'd appreciate if someone
more familiar with gfxmenu can review it.
--
Robert Millan
"Be the change you want to see in the world" -- Gandhi
=== modified file 'gfxmenu/gui_image.c'
--- gfxmenu/gui_image.c 2009-12-29 16:31:02 +0000
+++ gfxmenu/gui_image.c 2010-01-20 21:18:38 +0000
@@ -207,9 +207,25 @@ load_image (grub_gui_image_t self, const
static grub_err_t
image_set_property (void *vself, const char *name, const char *value)
{
+ static const char *theme_dir = NULL;
grub_gui_image_t self = vself;
- if (grub_strcmp (name, "file") == 0)
- return load_image (self, value);
+ if (grub_strcmp (name, "theme_dir") == 0)
+ {
+ theme_dir = value;
+ }
+ else if (grub_strcmp (name, "file") == 0)
+ {
+ char *absvalue;
+
+ /* Resolve to an absolute path. */
+ if (! theme_dir)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "unspecified theme_dir");
+ absvalue = grub_resolve_relative_path (theme_dir, value);
+ if (! absvalue)
+ return grub_errno;
+
+ return load_image (self, absvalue);
+ }
else if (grub_strcmp (name, "id") == 0)
{
grub_free (self->id);
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel