Support importing property file with expanded name
This change is to support importing property file with its path variations. By substitute its filename with another, it can be used to handle runtime varying filename within single binary. Here's an example of usage in property defined file. import /odm/build_${ro.boot.product.hardware.sku}.prop Bug: 132592551 Test: boot a device and checks above example import statement in "/odm/build.prop" loading expanded filename correctly Change-Id: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
This commit is contained in:
parent
bc420c4748
commit
a87c0f99ad
1 changed files with 7 additions and 1 deletions
|
@ -645,8 +645,14 @@ static void LoadProperties(char* data, const char* filter, const char* filename,
|
|||
while (isspace(*key)) key++;
|
||||
}
|
||||
|
||||
load_properties_from_file(fn, key, properties);
|
||||
std::string raw_filename(fn);
|
||||
std::string expanded_filename;
|
||||
if (!expand_props(raw_filename, &expanded_filename)) {
|
||||
LOG(ERROR) << "Could not expand filename '" << raw_filename << "'";
|
||||
continue;
|
||||
}
|
||||
|
||||
load_properties_from_file(expanded_filename.c_str(), key, properties);
|
||||
} else {
|
||||
value = strchr(key, '=');
|
||||
if (!value) continue;
|
||||
|
|
Loading…
Reference in a new issue