All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] gfxmenu relative path in "file" component of images
Date: Wed, 20 Jan 2010 23:37:04 +0100	[thread overview]
Message-ID: <20100120223704.GA25465@thorin> (raw)

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]


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

[-- Attachment #2: gfxmenu_relpath.diff --]
[-- Type: text/x-diff, Size: 987 bytes --]

=== 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);


             reply	other threads:[~2010-01-20 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 22:37 Robert Millan [this message]
2010-01-20 22:51 ` [PATCH] gfxmenu relative path in "file" component of images Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100120223704.GA25465@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.