[Archive] Add files recursively to an archive.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 12 Feb 2016 08:15:39 +0000 (09:15 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 12 Feb 2016 08:41:14 +0000 (09:41 +0100)
Fixes: SAD-62
[Verification] TCT pass rate (r31): 100% (106/106/0/0/0).

Change-Id: Ibbf439a0a6986caba57f6ba4066ef70f22226d96
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/archive/zip_add_request.cc

index 969b0fbbcf5e40261ccc5be92742b31299513871..543bdacfa0d1c534cad62e79a947a5174af7e144 100755 (executable)
@@ -88,9 +88,8 @@ PlatformResult ZipAddRequest::run()
     m_root_src_file = m_callback->getFileEntry()->getFile();
     m_root_src_file_node = m_root_src_file->getNode();
 
-    //We just need read permission to list files in subdirectories
-    LoggerW("STUB Not setting PERM_READ permissions");
-    //m_root_src_file_node->setPermissions(filesystem::PERM_READ);
+    // We just need read permission to list files in subdirectories
+    m_root_src_file_node->setPermissions(filesystem::PERM_READ);
 
     std::string src_basepath, src_name;
     getBasePathAndName(m_root_src_file_node->getPath()->getFullPath(), src_basepath,
@@ -189,11 +188,14 @@ void ZipAddRequest::addNodeAndSubdirsToList(filesystem::NodePtr src_node,
     out_list_of_child_nodes.push_back(src_node);
 
     if(filesystem::NT_DIRECTORY == src_node->getType()) {
-        LoggerW("STUB Not generating recursive list of files in directory");
-        //auto child_nodes = src_node->getChildNodes();
-        //for(auto it = child_nodes.begin(); it != child_nodes.end(); ++it) {
-        //    addNodeAndSubdirsToList(*it, out_list_of_child_nodes);
-        //}
+        LoggerD("Generating recursive list of files in directory");
+        NodeList child_nodes;
+        auto result = src_node->getChildNodes(&child_nodes);
+        if (result) {
+            for(const auto& it : child_nodes) {
+                addNodeAndSubdirsToList(it, out_list_of_child_nodes);
+            }
+        }
     }
 }