qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Win32: Get bios_dir from path of executable.


From: Stefan Weil
Subject: [Qemu-devel] [PATCH] Win32: Get bios_dir from path of executable.
Date: Thu, 28 May 2009 19:16:25 +0200

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 <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]