diff options
author | Dongcheol Shin <dc.shin@lge.com> | 2019-06-12 09:31:35 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-06-14 10:25:12 +0900 |
commit | ea9e783b4b44533dce0c741c84f6e6c8f916a538 (patch) | |
tree | 0c9bd5b20161c9b06c8387f056f9bbaf5a88e956 | |
parent | 607611e01692e66287d8a7ba58ef3182fa3e1d28 (diff) | |
download | core-ea9e783b4b44533dce0c741c84f6e6c8f916a538.tar.gz |
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
Merged-In: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
(cherry picked from commit a87c0f99adb742cd2b9a5d9911f04836eed79f05)
Change-Id: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
-rw-r--r-- | init/property_service.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp index fce8d578f..f2c7462ab 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -642,8 +642,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; |