[Messaging] Convert virtual paths to real ones.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 5 Oct 2015 13:02:28 +0000 (15:02 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 5 Oct 2015 13:02:28 +0000 (15:02 +0200)
[Verification] TCT pass rate for SMS/MMS/email is 100% (r47).

Change-Id: I295492f3e8a735a06bf6290d4faeb955b7707f0b
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/messaging/message.cc

index 129b1c7df4b91620d0026104a56fa02e95406a6f..70bc0ef126efc1d2d03b24581c4281e9c2f5b81a 100755 (executable)
@@ -23,6 +23,7 @@
 #include "common/logger.h"
 #include "common/platform_exception.h"
 #include "common/scope_exit.h"
+#include "common/virtual_fs.h"
 
 #include "Ecore_File.h"
 #include "message_email.h"
@@ -397,9 +398,7 @@ PlatformResult copyFileToTemp(const std::string& sourcePath, std::string* result
     std::string dirPath = "/tmp/" + std::string(buf);
 
     if ( sourcePath[0] != '/' ) {
-//  FIXME When filesystem will be available
-//         attPath = sourcePath; change to attPath = Filesystem::External::fromVirtualPath(sourcePath);
-        attPath = sourcePath;
+        attPath = common::VirtualFs::GetInstance().GetRealPath(sourcePath);
     } else { // Assuming that the path is a real path
         attPath = sourcePath;
     }
@@ -760,16 +759,9 @@ PlatformResult Message::addMMSBodyAndAttachmentsToStruct(const AttachmentPtrVect
             if (attach.at(i)->isFilePathSet()) {
                 std::string filepath = attach.at(i)->getFilePath();
                 LoggerD("att[%d]: org filepath: %s", i, filepath.c_str());
-// TODO uncomment when filesystem will be available
-//                if(Filesystem::External::isVirtualPath(filepath)) {
-//                    // TODO
-//                    // When introducing below line fromVirtualPath() function
-//                    // needed context, but never used it - allowing for null
-//                    // context pointer. If it appears to need a real context
-//                    // it will need a fix here.
-//                    filepath = Filesystem::External::fromVirtualPath(filepath);
-//                    LoggerD("att[%d]: org virtual filepath: %s", i, filepath.c_str());
-//                }
+                filepath = common::VirtualFs::GetInstance().GetRealPath(filepath);
+                LoggerD("att[%d]: org virtual filepath: %s", i, filepath.c_str());
+
                 msg_set_str_value(tmpAtt, MSG_MMS_ATTACH_FILEPATH_STR,
                         const_cast<char*>(filepath.c_str()), filepath.size());
                 const size_t last_slash_idx = filepath.find_last_of("\\/");