Create '.applications/manifest/' if not exist 53/41953/1
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 18 Jun 2015 14:00:11 +0000 (16:00 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Fri, 19 Jun 2015 08:20:21 +0000 (10:20 +0200)
Change-Id: I5fc8e03e7dbd92a3581a38ad9c5f2834f809f6be

src/common/step/step_generate_xml.cc

index 322668c..2f56380 100755 (executable)
@@ -5,6 +5,7 @@
 
 #include "common/step/step_generate_xml.h"
 
+#include <boost/system/error_code.hpp>
 #include <libxml/parser.h>
 #include <libxml/xmlreader.h>
 #include <pkgmgr-info.h>
@@ -19,6 +20,7 @@
 #include "utils/clist_helpers.h"
 #include "utils/file_util.h"
 
+namespace bs = boost::system;
 namespace fs = boost::filesystem;
 
 namespace common_installer {
@@ -172,6 +174,15 @@ Step::Status StepGenerateXml::process() {
   xml_path += ".xml";
   context_->xml_path.set(xml_path.string());
 
+  bs::error_code error;
+  if (!fs::exists(xml_path.parent_path(), error)) {
+    if (!utils::CreateDir(xml_path.parent_path())) {
+      LOG(ERROR) <<
+          "Directory for manifest xml is missing and cannot be created";
+      return Status::ERROR;
+    }
+  }
+
   xmlTextWriterPtr writer;
 
   writer = xmlNewTextWriterFilename(context_->xml_path.get().c_str(), 0);