summaryrefslogtreecommitdiff
path: root/util/oslib-win32.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-02-24 15:37:59 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-02-24 15:38:00 +0000
commit6dedf0522c3fdeb10fe27d4aef35f4c57f3d0806 (patch)
treee1177c7fd43a8165c8f697ff0aa5a5e6fcdd7766 /util/oslib-win32.c
parent98b21dcdb331798709edafcd65b5b7a1e07302db (diff)
parentf966f9ddd175bdf82f12650c3b7b5a93cc421d88 (diff)
downloadqemu-6dedf0522c3fdeb10fe27d4aef35f4c57f3d0806.tar.gz
Merge remote-tracking branch 'remotes/bonzini/configure' into staging
* remotes/bonzini/configure: build: softmmu targets do not have a "main.o" file configure: Disable libtool if -fPIE does not work with it (bug #1257099) block: convert block drivers linked with libs to modules Makefile: introduce common-obj-m and block-obj-m for DSO Makefile: install modules with "make install" module: implement module loading rules.mak: introduce DSO rules darwin: do not use -mdynamic-no-pic block: use per-object cflags and libs rules.mak: allow per object cflags and libs rules.mak: fix $(obj) to a real relative path util: Split out exec_dir from os_find_datadir Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/oslib-win32.c')
-rw-r--r--util/oslib-win32.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 50be0440f2..93f7d351d3 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -208,3 +208,33 @@ void qemu_set_tty_echo(int fd, bool echo)
dwMode & ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT));
}
}
+
+static char exec_dir[PATH_MAX];
+
+void qemu_init_exec_dir(const char *argv0)
+{
+
+ char *p;
+ char buf[MAX_PATH];
+ DWORD len;
+
+ len = GetModuleFileName(NULL, buf, sizeof(buf) - 1);
+ if (len == 0) {
+ return;
+ }
+
+ buf[len] = 0;
+ p = buf + len - 1;
+ while (p != buf && *p != '\\') {
+ p--;
+ }
+ *p = 0;
+ if (access(buf, R_OK) == 0) {
+ pstrcpy(exec_dir, sizeof(exec_dir), buf);
+ }
+}
+
+char *qemu_get_exec_dir(void)
+{
+ return g_strdup(exec_dir);
+}