From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NXjAv-0001To-Ka for mharc-grub-devel@gnu.org; Wed, 20 Jan 2010 17:37:21 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXjAq-0001MP-7P for grub-devel@gnu.org; Wed, 20 Jan 2010 17:37:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXjAk-0001Cb-SN for grub-devel@gnu.org; Wed, 20 Jan 2010 17:37:15 -0500 Received: from [199.232.76.173] (port=39496 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXjAk-0001CR-PP for grub-devel@gnu.org; Wed, 20 Jan 2010 17:37:10 -0500 Received: from xvm-190-8.ghst.net ([217.70.190.8]:55877 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NXjAk-0002PI-6U for grub-devel@gnu.org; Wed, 20 Jan 2010 17:37:10 -0500 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1NXjAg-0005Rj-21 for grub-devel@gnu.org; Wed, 20 Jan 2010 23:37:06 +0100 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1NXjAe-0006cq-N7 for grub-devel@gnu.org; Wed, 20 Jan 2010 23:37:04 +0100 Date: Wed, 20 Jan 2010 23:37:04 +0100 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20100120223704.GA25465@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] gfxmenu relative path in "file" component of images X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2010 22:37:16 -0000 --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --45Z9DzgjV8m4Oswq Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="gfxmenu_relpath.diff" === 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); --45Z9DzgjV8m4Oswq--