[Common] Fixed VirtualFs::GetRealPath() method.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 3 Jun 2015 10:16:07 +0000 (12:16 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 3 Jun 2015 10:18:57 +0000 (12:18 +0200)
[Verification] This method is used only by Download. Pass rate did not change.

Change-Id: Ia3ae086ea58fdc178edf468c42ffea6cb6d2d073
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/common/virtual_fs.cc

index 1cd236a..97983fc 100755 (executable)
@@ -268,6 +268,7 @@ optional<std::string> VirtualFs::GetApplicationDirectory() const {
 
 std::string VirtualFs::GetRealPath(const std::string& path_or_uri) const {
   LoggerD("Enter");
+  SLoggerD("Input: [%s]", path_or_uri.c_str());
   std::string realpath;
   std::size_t pos = path_or_uri.find(kFileUriPrefix);
   if (pos != std::string::npos) {
@@ -280,11 +281,12 @@ std::string VirtualFs::GetRealPath(const std::string& path_or_uri) const {
     const std::string prefix = realpath.substr(0, pos);
     const auto it = g_virtual_roots.find(prefix);
     if (it != g_virtual_roots.end()) {
-      realpath.replace(0, it->second.path_.size(), it->second.path_);
+      realpath.replace(0, prefix.size(), it->second.path_);
     } else {
       LoggerE("Unknown virtual root");
     }
   }
+  SLoggerD("Exit: [%s]", realpath.c_str());
   return realpath;
 }