[Download] Convert virtual path to real path in start().
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 30 Mar 2015 08:42:20 +0000 (10:42 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 30 Mar 2015 09:31:15 +0000 (18:31 +0900)
Change-Id: I83ccc08273093bbc9089701ea1bc41eff3ac7ae7

src/download/download_instance.cc

index b6ab43f6884327414b463deb692b51d0a187d69d..1514ca28b31b002e88a2819200b9ec850a015cb0 100644 (file)
@@ -12,7 +12,7 @@
 #include "common/logger.h"
 #include "common/platform_exception.h"
 #include "common/typeutil.h"
-
+#include "common/virtual_fs.h"
 
 namespace extension {
 namespace download {
@@ -330,7 +330,8 @@ void DownloadInstance::DownloadManagerStart
   if (!args.get("destination").is<picojson::null>()) {
     if (args.get("destination").get<std::string>() != "") {
       diPtr->destination = args.get("destination").get<std::string>();
-      // need to use filesystem API
+      // TODO: move conversion to JS
+      diPtr->destination = common::VirtualFs::GetInstance().GetRealPath(diPtr->destination);
     }
   }
 
@@ -426,9 +427,8 @@ void DownloadInstance::DownloadManagerStart
 
   const char* dest;
 
-  if (diPtr->destination == "Downloads") {
-    dest = "/opt/usr/media/Downloads";  //  ret = download_set_destination(diPtr->download_id, diPtr->destination.c_str());
-    ret = download_set_destination(diPtr->download_id, dest);
+  if (diPtr->destination.size() != 0) {
+    ret = download_set_destination(diPtr->download_id, diPtr->destination.c_str());
   }
 
   if (!diPtr->file_name.empty()) {