summaryrefslogtreecommitdiff
path: root/os-win32.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-02-10 14:48:51 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-02-20 13:12:54 +0100
commit10f5bff622cad71645e22c027b77ac31e51008ef (patch)
tree350ebef38d05121c3b438ef43145c59a0ff7da81 /os-win32.c
parent46eef33b89e936ca793e13c4aeea1414e97e8dbb (diff)
downloadqemu-10f5bff622cad71645e22c027b77ac31e51008ef.tar.gz
util: Split out exec_dir from os_find_datadir
With this change, main() calls qemu_init_exec_dir and uses argv[0] to init exec_dir. The saved value can be retrieved with qemu_get_exec_dir later. It will be reused by module loading. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'os-win32.c')
-rw-r--r--os-win32.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/os-win32.c b/os-win32.c
index 50b7f6f885..5f95caac15 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -84,26 +84,9 @@ void os_setup_early_signal_handling(void)
}
/* Look for support files in the same directory as the executable. */
-char *os_find_datadir(const char *argv0)
+char *os_find_datadir(void)
{
- char *p;
- char buf[MAX_PATH];
- DWORD len;
-
- len = GetModuleFileName(NULL, buf, sizeof(buf) - 1);
- if (len == 0) {
- return NULL;
- }
-
- buf[len] = 0;
- p = buf + len - 1;
- while (p != buf && *p != '\\')
- p--;
- *p = 0;
- if (access(buf, R_OK) == 0) {
- return g_strdup(buf);
- }
- return NULL;
+ return qemu_get_exec_dir();
}
void os_set_line_buffering(void)