From 41c787acecaa497b2ee5fd8297feb7be976d0f1d Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Thu, 23 Jun 2011 18:23:08 +0200 Subject: Fix -sysdir handling. This is a back-port from master to tools_r13 This patch fixes the processing of the -sysdir option. Previously, using -sysdir would imply that the -system //system.img is used, which is incorrect. Also fixes the skin search for the case where we are using the emulator without a pre-existing AVD outside of platform builds (e.g. when running tests). This happens with stuff like: emulator -sysdir /path/to/known/sdk/platforms//images The patch ensures that the /path/to/known/sdk/platforms//skins directory is probed (this was the behaviour of the Tools R11 emulator). Change-Id: Ibf7ad97de8e1da375f1049600807e0b3d30bfaaa Orig-Change-Id: I32398bec0d7a28ead234f63c847d3ec95ed14b63 Orig-Change-Id: Id77ea9bdc55bb99c1bfbd2ade291ec41f31ec65d --- android/avd/info.c | 12 ++++++++++++ android/main-common.c | 2 +- android/main.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/android/avd/info.c b/android/avd/info.c index a9fc711..1ab066c 100644 --- a/android/avd/info.c +++ b/android/avd/info.c @@ -1117,6 +1117,17 @@ avdInfo_getSkinInfo( AvdInfo* i, char** pSkinName, char** pSkinDir ) if (skinPath != NULL) break; } + + /* or in the parent directory of the system dir */ + { + char* parentDir = path_parent(i->androidOut, 1); + if (parentDir != NULL) { + skinPath = _checkSkinSkinsDir(parentDir, skinName); + AFREE(parentDir); + if (skinPath != NULL) + break; + } + } } /* look in the search paths. For each in the list, @@ -1137,6 +1148,7 @@ avdInfo_getSkinInfo( AvdInfo* i, char** pSkinName, char** pSkinDir ) } /* We didn't find anything ! */ + *pSkinName = skinName; return; } while (0); diff --git a/android/main-common.c b/android/main-common.c index 05a2cb0..94accf7 100644 --- a/android/main-common.c +++ b/android/main-common.c @@ -850,7 +850,7 @@ AvdInfo* createAVD(AndroidOptions* opts, int* inAndroidBuild) if (!opts->system) { opts->system = _getSdkSystemImage(opts->sysdir, "-image", "system.img"); - D("autoconfig: -image %s", opts->image); + D("autoconfig: -system %s", opts->system); } if (!opts->kernel) { diff --git a/android/main.c b/android/main.c index 3629c83..ec7ea61 100644 --- a/android/main.c +++ b/android/main.c @@ -548,7 +548,7 @@ int main(int argc, char **argv) } /* If -system is used, use it to find the initial image */ - if (opts->sysdir != NULL) { + if (opts->sysdir != NULL && !path_exists(opts->system)) { initImage = _getFullFilePath(opts->sysdir, opts->system); } else { initImage = ASTRDUP(opts->system); -- cgit v1.1