Revision 6170540b os-win32.c

b/os-win32.c
181 181
        }
182 182
    }
183 183
}
184

  
185
/* Look for support files in the same directory as the executable.  */
186
char *os_find_datadir(const char *argv0)
187
{
188
    char *p;
189
    char buf[MAX_PATH];
190
    DWORD len;
191

  
192
    len = GetModuleFileName(NULL, buf, sizeof(buf) - 1);
193
    if (len == 0) {
194
        return NULL;
195
    }
196

  
197
    buf[len] = 0;
198
    p = buf + len - 1;
199
    while (p != buf && *p != '\\')
200
        p--;
201
    *p = 0;
202
    if (access(buf, R_OK) == 0) {
203
        return qemu_strdup(buf);
204
    }
205
    return NULL;
206
}

Also available in: Unified diff