[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-commits] [COMMIT 5cea859] Use relative path for bios
From: |
Stefan Weil |
Subject: |
Re: [Qemu-commits] [COMMIT 5cea859] Use relative path for bios |
Date: |
Mon, 08 Jun 2009 16:14:07 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Anthony Liguori schrieb:
> From: Paul Brook <address@hidden>
>
> Look for bios and other support files relative to qemu binary, rather than
> a hardcoded prefix.
>
> Signed-off-by: Paul Brook <address@hidden>
>
> diff --git a/vl.c b/vl.c
> index f8c0d00..fcf8532 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -33,6 +33,7 @@
> #include "config-host.h"
>
> #ifndef _WIN32
> +#include <libgen.h>
> #include <pwd.h>
> #include <sys/times.h>
> #include <sys/wait.h>
> @@ -191,7 +192,7 @@ int main(int argc, char **argv)
> /* XXX: use a two level table to limit memory usage */
> #define MAX_IOPORTS 65536
>
> -const char *bios_dir = CONFIG_QEMU_SHAREDIR;
> +static const char *data_dir;
> const char *bios_name = NULL;
> static void *ioport_opaque[MAX_IOPORTS];
> static IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS];
> @@ -4795,6 +4796,128 @@ static void termsig_setup(void)
>
> #endif
>
> +#ifdef _WIN32
> +/* Look for support files in the same directory as the executable. */
> +static char *find_datadir(const char *argv0)
> +{
> + char *p;
> + char buf[MAX_PATH];
> + DWORD len;
> +
> + len = GetModuleFileName(NULL, buf, sizeof(buf) - 1);
> + if (len == 0) {
> + return len;
>
int value returned???
> + }
> +
> + buf[len] = 0;
> + p = buf + len - 1;
> + while (p != buf && *p != '\\')
> + p--;
> + *p = 0;
> + if (access(buf, R_OK) == 0) {
> + return qemu_strdup(buf);
> + }
> + return NULL;
> +}
>