Win32: Get bios_dir from path of executable.
PATCH 1/1 Win32: Get bios_dir from path of executable.
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).
--- configure | 2 ++ vl.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
configure +2 -0
@@ -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
vl.c +13 -0
@@ -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 );
Signature · 1 line
1.5.6.5
Quoted 3 lines · Stefan Weil
The old value
CONFIG_QEMU_SHAREDIRuses a path which is not standard for most Windows installations (c:\Program Files is c:\Programme in german).
Will the patch at
http://article.gmane.org/gmane.comp.emulators.qemu/38346
help this?
Amit
Quoted 5 lines · Amit Shah
Quoted 3 lines · Stefan Weil
The old value
CONFIG_QEMU_SHAREDIRuses a path which is not standard for most Windows installations (c:\Program Files is c:\Programme in german).
Quoted 7 lines
Will the patch at
http://article.gmane.org/gmane.comp.emulators.qemu/38346
help this?
Amit
No, it won't help. That patch still uses CONFIG_QEMU_SHAREDIR:
+ set_datafile_dir(CONFIG_QEMU_SHAREDIR);
And using this constant macro is the problem, because Windows program directory is not constant.
Regards,
Stefan