Setting proper icon name in tpk manifest 40/46640/4
authorWojciech Kosowicz <w.kosowicz@samsung.com>
Mon, 24 Aug 2015 09:48:50 +0000 (11:48 +0200)
committerWojciech Kosowicz <w.kosowicz@samsung.com>
Mon, 24 Aug 2015 10:45:20 +0000 (12:45 +0200)
Also included style fixes for the project
Change-Id: I2e6ebc71f408e7df91684bc166c435271e27ca73

src/tpk/step/step_copy_manifest_xml.cc
src/wgt/step/step_generate_xml.cc
src/wgt/step/step_parse_recovery.h

index bb71e26..f327589 100644 (file)
@@ -70,6 +70,8 @@ namespace {
         boost::regex_constants::ECMAScript);
     boost::regex manifest_type_replace_pattern("<manifest ",
         boost::regex_constants::ECMAScript);
+    boost::regex icon_replace_pattern("(?<=<icon>).*(?=<\/icon>)",
+        boost::regex_constants::perl);
 
     boost::smatch m;
 
@@ -79,6 +81,16 @@ namespace {
 
       try {
         // Find (ui|service)-application element, and get appid
+        if (boost::regex_search(line, m, icon_replace_pattern)) {
+          bf::path match_result(m[0].str());
+          bf::path extension = match_result.extension();
+          result = boost::regex_replace(line,
+              icon_replace_pattern,
+              std::string(context_->manifest_data.get()->mainapp_id
+                          + extension.native()));
+          // TODO(w.kosowicz): internatialization when supported
+        }
+        // Find (ui|service)-application element, and get appid
         if (boost::regex_search(line, m, appid_pattern)) {
           pkg_path /= bf::path("bin");
 
index 88c702e..95812f8 100755 (executable)
@@ -44,8 +44,8 @@ static void _writeServiceApplicationAttributes(
 }
 
 template <typename T>
-common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml(T* app,
-    xmlTextWriterPtr writer) {
+common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml(
+    T* app, xmlTextWriterPtr writer) {
   // common appributes among uiapplication_x and serviceapplication_x
   xmlTextWriterWriteAttribute(writer, BAD_CAST "appid", BAD_CAST app->appid);
 
index a117452..db6a349 100644 (file)
@@ -24,7 +24,7 @@ namespace parse {
  */
 class StepParseRecovery : public StepParse {
  public:
-  StepParseRecovery(common_installer::ContextInstaller* context);
+  explicit StepParseRecovery(common_installer::ContextInstaller* context);
 
   Status process() override;
   Status precheck() override;