diff options
author | David Turner <digit@android.com> | 2011-03-04 08:25:16 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-03-04 08:25:16 -0800 |
commit | 40ee75d90cdaaaec1006cbc91864b11dba09c351 (patch) | |
tree | 514a627f516fefd0e6672b420ae36d9183c50d97 | |
parent | 44374ce7ef50bd50fa647fb9dc32b11fb2a8ad26 (diff) | |
parent | 02c6385fd50f926d0f0801dfe60480cd90d8df81 (diff) | |
download | external_qemu-40ee75d90cdaaaec1006cbc91864b11dba09c351.zip external_qemu-40ee75d90cdaaaec1006cbc91864b11dba09c351.tar.gz external_qemu-40ee75d90cdaaaec1006cbc91864b11dba09c351.tar.bz2 |
Merge "look for the pc-bios files in the SDK tools/lib/pc-bios directory"
-rw-r--r-- | vl-android.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/vl-android.c b/vl-android.c index cb32eb2..b93ce9c 100644 --- a/vl-android.c +++ b/vl-android.c @@ -3547,9 +3547,11 @@ static char *find_datadir(const char *argv0) /* Find a likely location for support files using the location of the binary. For installed binaries this will be "$bindir/../share/qemu". When - running from the build tree this will be "$bindir/../pc-bios". */ + running from the build tree this will be "$bindir/../pc-bios". + The emulator running from the SDK will find the support files in $bindir/lib/pc-bios. */ #define SHARE_SUFFIX "/share/qemu" #define BUILD_SUFFIX "/pc-bios" +#define SDK_SUFFIX "/lib/pc-bios" static char *find_datadir(const char *argv0) { char *dir; @@ -3590,19 +3592,25 @@ static char *find_datadir(const char *argv0) return NULL; } } - dir = dirname(p); - dir = dirname(dir); - max_len = strlen(dir) + - MAX(strlen(SHARE_SUFFIX), strlen(BUILD_SUFFIX)) + 1; +#define STRLEN_CONST(str) (sizeof(str)-1) + dir = dirname(p); + max_len = strlen(dir) + 1 + + MAX(STRLEN_CONST(SDK_SUFFIX), MAX(STRLEN_CONST(SHARE_SUFFIX), STRLEN_CONST(BUILD_SUFFIX))); res = qemu_mallocz(max_len); - snprintf(res, max_len, "%s%s", dir, SHARE_SUFFIX); + + snprintf(res, max_len, "%s%s", dir, SDK_SUFFIX); if (access(res, R_OK)) { - snprintf(res, max_len, "%s%s", dir, BUILD_SUFFIX); - if (access(res, R_OK)) { - qemu_free(res); - res = NULL; - } + dir = dirname(dir); + + snprintf(res, max_len, "%s%s", dir, SHARE_SUFFIX); + if (access(res, R_OK)) { + snprintf(res, max_len, "%s%s", dir, BUILD_SUFFIX); + if (access(res, R_OK)) { + qemu_free(res); + res = NULL; + } + } } #ifndef PATH_MAX free(p); |