system/corennnnn
Revision | 9914284d6afb1734747940de2c466f67078e4365 (tree) |
---|---|
Time | 2016-08-23 09:26:19 |
Author | Daniel Rosenberg <drosen@goog...> |
Commiter | Daniel Rosenberg |
DO NOT MERGE: Fix bug in product path building
-p <product> was failing to find the product image files since
get_my_path's result was ignored. As it was, it would only work
if you happened to call it from $OUT.
Change-Id: Id4183cb7fafb313c0b1feff93d7e22fd4658d267
Bug: 31022767
@@ -116,16 +116,18 @@ static struct { | ||
116 | 116 | }; |
117 | 117 | |
118 | 118 | static std::string find_item_given_name(const char* img_name, const char* product) { |
119 | - char *dir; | |
120 | - char path[PATH_MAX + 128]; | |
119 | + char path_c_str[PATH_MAX + 128]; | |
121 | 120 | |
122 | 121 | if(product) { |
123 | - get_my_path(path); | |
124 | - return android::base::StringPrintf("../../../target/product/%s/%s", product, img_name); | |
122 | + get_my_path(path_c_str); | |
123 | + std::string path = path_c_str; | |
124 | + path.erase(path.find_last_of('/')); | |
125 | + return android::base::StringPrintf("%s/../../../target/product/%s/%s", | |
126 | + path.c_str(), product, img_name); | |
125 | 127 | } |
126 | 128 | |
127 | - dir = getenv("ANDROID_PRODUCT_OUT"); | |
128 | - if((dir == 0) || (dir[0] == 0)) { | |
129 | + char *dir = getenv("ANDROID_PRODUCT_OUT"); | |
130 | + if (dir == nullptr || dir[0] == '\0') { | |
129 | 131 | die("neither -p product specified nor ANDROID_PRODUCT_OUT set"); |
130 | 132 | } |
131 | 133 |