From b84fb1ddd871248eb8f00b40b965873bb28aa8eb Mon Sep 17 00:00:00 2001 From: Siva Velusamy Date: Mon, 8 Oct 2012 15:15:05 -0700 Subject: Obtain path to dynamic skin layout folder from sdk root Change-Id: Id83e082238f696aaa0c330020e3310b20ebe5a32 --- android/main-common.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/android/main-common.c b/android/main-common.c index 5c82005..78f4b30 100644 --- a/android/main-common.c +++ b/android/main-common.c @@ -24,6 +24,7 @@ #include "console.h" +#include "android/avd/util.h" #include "android/utils/debug.h" #include "android/utils/path.h" #include "android/utils/bufprint.h" @@ -413,7 +414,7 @@ add_parts_to_layout(AConfig* layout, int load_dynamic_skin(AndroidHwConfig* hwConfig, - const char* skinDirPath, + char** skinDirPath, int width, int height, AConfig* root) @@ -422,15 +423,22 @@ load_dynamic_skin(AndroidHwConfig* hwConfig, AConfig* node; int i; int max_part_width; + char fromEnv; + char* sdkRoot = path_getSdkRoot(&fromEnv); - if (skinDirPath == NULL) + if (sdkRoot == NULL) { + dwarning("Unable to locate sdk root. Will not use dynamic skin."); return 0; + } + + snprintf(tmp, sizeof(tmp), "%s/tools/lib/emulator/skins/dynamic/", sdkRoot); + free(sdkRoot); - snprintf(tmp, sizeof(tmp), "%s/dynamic", skinDirPath); if (!path_exists(tmp)) return 0; - snprintf(tmp, sizeof(tmp), "%s/dynamic/layout", skinDirPath); + *skinDirPath = strdup(tmp); + snprintf(tmp, sizeof(tmp), "%s/layout", *skinDirPath); D("trying to load skin file '%s'", tmp); if(aconfig_load_file(root, tmp) < 0) { @@ -599,9 +607,9 @@ parse_skin_files(const char* skinDirPath, } if (opts->dynamic_skin) { - if (load_dynamic_skin(hwConfig, skinDirPath, width, height, root)) { - snprintf(tmp, sizeof tmp, "%s/dynamic/", skinDirPath); - path = tmp; + char *dynamicSkinDirPath; + if (load_dynamic_skin(hwConfig, &dynamicSkinDirPath, width, height, root)) { + path = dynamicSkinDirPath; D("loaded dynamic skin width=%d height=%d bpp=%d\n", width, height, bpp); goto FOUND_SKIN; } -- cgit v1.1