Revision 10f5bff6 util/oslib-win32.c

b/util/oslib-win32.c
208 208
                       dwMode & ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT));
209 209
    }
210 210
}
211

  
212
static char exec_dir[PATH_MAX];
213

  
214
void qemu_init_exec_dir(const char *argv0)
215
{
216

  
217
    char *p;
218
    char buf[MAX_PATH];
219
    DWORD len;
220

  
221
    len = GetModuleFileName(NULL, buf, sizeof(buf) - 1);
222
    if (len == 0) {
223
        return;
224
    }
225

  
226
    buf[len] = 0;
227
    p = buf + len - 1;
228
    while (p != buf && *p != '\\') {
229
        p--;
230
    }
231
    *p = 0;
232
    if (access(buf, R_OK) == 0) {
233
        pstrcpy(exec_dir, sizeof(exec_dir), buf);
234
    }
235
}
236

  
237
char *qemu_get_exec_dir(void)
238
{
239
    return g_strdup(exec_dir);
240
}

Also available in: Unified diff