From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M9jDU-0004GM-Ij for qemu-devel@nongnu.org; Thu, 28 May 2009 13:16:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M9jDR-0004EV-0r for qemu-devel@nongnu.org; Thu, 28 May 2009 13:16:32 -0400 Received: from [199.232.76.173] (port=48470 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M9jDQ-0004EJ-LW for qemu-devel@nongnu.org; Thu, 28 May 2009 13:16:28 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:61580) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M9jDP-0007Wi-W2 for qemu-devel@nongnu.org; Thu, 28 May 2009 13:16:28 -0400 From: Stefan Weil Date: Thu, 28 May 2009 19:16:25 +0200 Message-Id: <1243530985-23963-1-git-send-email-weil@mail.berlios.de> Subject: [Qemu-devel] [PATCH] Win32: Get bios_dir from path of executable. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The old value CONFIG_QEMU_SHAREDIR uses a path which is not standard for most Windows installations (c:\Program Files is c:\Programme in german). Signed-off-by: Stefan Weil --- configure | 2 ++ vl.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 21c0633..3dfd6a8 100755 --- a/configure +++ b/configure @@ -1394,7 +1394,9 @@ echo "bindir=\${prefix}$binsuffix" >> $config_mak echo "mandir=\${prefix}$mansuffix" >> $config_mak echo "datadir=\${prefix}$datasuffix" >> $config_mak echo "docdir=\${prefix}$docsuffix" >> $config_mak +if test "$mingw32" = "no" ; then echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h +fi echo "MAKE=$make" >> $config_mak echo "INSTALL=$install" >> $config_mak echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak diff --git a/vl.c b/vl.c index f8c0d00..4cce5b3 100644 --- a/vl.c +++ b/vl.c @@ -191,7 +191,11 @@ int main(int argc, char **argv) /* XXX: use a two level table to limit memory usage */ #define MAX_IOPORTS 65536 +#if defined(_WIN32) +const char *bios_dir; +#else const char *bios_dir = CONFIG_QEMU_SHAREDIR; +#endif const char *bios_name = NULL; static void *ioport_opaque[MAX_IOPORTS]; static IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS]; @@ -4873,6 +4877,15 @@ int main(int argc, char **argv, char **envp) } } } + + /* Derive the bios path name from the name of the executable. */ + { + char filename[MAX_PATH]; + GetModuleFileName(0, filename, sizeof(filename)); + char *p = strrchr(filename, '\\'); + if (p) *p = '\0'; + bios_dir = qemu_strdup(filename); + } #endif module_call_init(MODULE_INIT_MACHINE); -- 1.5.6.5