Remove hardcoded path for multiuser support 12/16612/1 tizen submit/tizen_common/20140521.163740
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Thu, 19 Dec 2013 15:35:02 +0000 (16:35 +0100)
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Wed, 19 Feb 2014 15:05:57 +0000 (16:05 +0100)
Bug-Tizen: PTREL-380

Change-Id: Idb2ce738ee59c0789513046501012192135435b9
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
packaging/wrt-plugins-tizen.spec
src/Filesystem/CMakeLists.txt
src/Filesystem/Manager.cpp
src/Messaging/AttachmentFactory.cpp
src/Messaging/CMakeLists.txt
src/Messaging/EmailUtils.h
src/Messaging/messageDB/MsgSqliteWrapper.h
src/Systeminfo/CMakeLists.txt
src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
src/Systeminfo/Systeminfo.cpp

index 6149055..5b0061b 100755 (executable)
@@ -100,6 +100,8 @@ BuildRequires:  boost-devel
 BuildRequires:  boost-thread
 BuildRequires:  boost-system
 BuildRequires:  boost-filesystem
+BuildRequires:  pkgconfig(libtzplatform-config)
+Requires:       libtzplatform-config
 
 %description
 JavaScript plugins for WebRuntime
index 3b67e79..2854de1 100755 (executable)
@@ -3,7 +3,7 @@ SET(DESTINATION_NAME ${filesystem_dest})
 SET(TARGET_IMPL_NAME ${filesystem_impl})
 SET(TARGET_CONFIG_NAME ${filesystem_config})
 
-PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore)
+PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore libtzplatform-config)
 
 ADD_DEFINITIONS("-fvisibility=hidden")
 
index fb89f82..6871d09 100644 (file)
 #include "Utils.h"
 #include <app.h>
 #include <Logger.h>
+#include <tzplatform_config.h>
 
 namespace {
-const char* PATH_DOWNLOADS = "/opt/usr/media/Downloads";
-const char* PATH_DOCUMENTS = "/opt/usr/media/Documents";
-const char* PATH_SOUNDS = "/opt/usr/media/Sounds";
-const char* PATH_IMAGES = "/opt/usr/media/Images";
-const char* PATH_VIDEOS = "/opt/usr/media/Videos";
-const char* PATH_RINGTONE = "/opt/usr/share/settings/Ringtones";
+const char* PATH_DOWNLOADS = tzplatform_getenv(TZ_USER_DOWNLOADS);
+const char* PATH_DOCUMENTS = tzplatform_getenv(TZ_USER_DOCUMENTS);
+const char* PATH_SOUNDS = tzplatform_getenv(TZ_USER_SOUNDS);
+const char* PATH_IMAGES = tzplatform_getenv(TZ_USER_IMAGES);
+const char* PATH_VIDEOS = tzplatform_getenv(TZ_USER_VIDEOS);
+const char* PATH_RINGTONE = tzplatform_mkpath(TZ_USER_SHARE,"settings/Ringtones");
 }
 
 using namespace WrtDeviceApis;
index 6a6662e..5d494d6 100755 (executable)
@@ -22,6 +22,7 @@
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <WidgetDB/WidgetDBMgr.h>
 #include <Logger.h>
+#include <tzplatform_config.h>
 
 using namespace std;
 using namespace WrtDeviceApis;
@@ -29,11 +30,11 @@ using namespace WrtDeviceApis::Commons;
 using namespace DeviceAPI::Messaging;
 
 namespace {
-const char* PATH_DOWNLOADS = "/opt/usr/media/Downloads";
-const char* PATH_DOCUMENTS = "/opt/usr/media/Documents";
-const char* PATH_SOUNDS = "/opt/usr/media/Sounds";
-const char* PATH_IMAGES = "/opt/usr/media/Images";
-const char* PATH_VIDEOS = "/opt/usr/media/Videos";
+const char* PATH_DOWNLOADS = tzplatform_getenv(TZ_USER_DOWNLOADS);
+const char* PATH_DOCUMENTS = tzplatform_getenv(TZ_USER_DOCUMENTS);
+const char* PATH_SOUNDS = tzplatform_getenv(TZ_USER_SOUNDS);
+const char* PATH_IMAGES = tzplatform_getenv(TZ_USER_IMAGES);
+const char* PATH_VIDEOS = tzplatform_getenv(TZ_USER_VIDEOS);
 
 const char* VPATH_DOWNLOADS = "download";
 const char* VPATH_DOCUMENTS = "documents";
index db14749..b05543b 100755 (executable)
@@ -9,6 +9,7 @@ PKG_CHECK_MODULES(platform_pkgs_messaging REQUIRED
        capi-system-info
     capi-network-connection
        tapi
+        libtzplatform-config
 )
 
 ADD_DEFINITIONS("-fvisibility=hidden")
index 68e7d60..413dc45 100755 (executable)
@@ -20,6 +20,7 @@
 
 #include <string>
 
+#include <tzplatform_config.h>
 #include "Recipient.h"
 
 namespace DeviceAPI {
@@ -67,7 +68,8 @@ static const std::string TMP_DIR_PREFIX = "/tmp/";
 static const std::string TMP_DIR_SEPERATOR = "/";
 static const std::string TMP_PLAIN_FILE = "utf-8";
 static const std::string TMP_HTML_FILE = "utf-8.htm";
-static const std::string EMAIL_DATA_FILE_PATH = "/opt/usr/data/email";
+
+#define EMAIL_DATA_FILE_PATH tzplatform_mkpath(TZ_USER_DATA,"email")
 
 }
 }
index 2865518..8e100c6 100644 (file)
                                     INCLUDE FILES
 ==================================================================================================*/
 #include "msg_types.h"
-
+#include <tzplatform_config.h>
 
 /*==================================================================================================
                                     DEFINES
 ==================================================================================================*/
-#define MSGFW_DB_NAME                  "/opt/usr/dbspace/.msg_service.db"
+#define MSGFW_DB_NAME                  tzplatform_mkpath(TZ_USER_DB,".msg_service.db")
 
 #define MSGFW_MESSAGE_TABLE_NAME               "MSG_MESSAGE_TABLE"
 #define MSGFW_FOLDER_TABLE_NAME                        "MSG_FOLDER_TABLE"
index f336da6..13d7abf 100755 (executable)
@@ -9,6 +9,7 @@ PKG_CHECK_MODULES(platform_pkgs_systeminfo REQUIRED
        capi-system-sensor
        sensor
        tapi
+       libtzplatform-config
 )
 
 IF(ENABLE_OPTIONAL_SYSINFO_TEL_SIM_MNGT)
index ed90aa4..d05b5ba 100755 (executable)
@@ -28,6 +28,7 @@
 #include "JSDeviceCapabilitiesInfo.h"
 #include "plugin_config.h"
 #include <Logger.h>
+#include <tzplatform_config.h>
 
 #define MAXBUFSIZE 256
 #define DEVICE_PROFILE "MOBILE_FULL"
@@ -686,7 +687,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DUID)) {
             FILE *fp = NULL;
             char duid[DUID_BUFFER_SIZE] = {0,};
-            fp = fopen("/opt/usr/etc/system_info_cache.ini", "r");
+            fp = fopen(tzplatform_mkpath(TZ_USER_ETC,"system_info_cache.ini"), "r");
 
             if(fp == NULL) {
                 LoggerD("fail file open.");
index f94944c..8216baa 100755 (executable)
@@ -24,6 +24,7 @@
 #include <TimeTracer.h>
 #include "Systeminfo.h"
 #include <Logger.h>
+#include <tzplatform_config.h>
 
 using namespace WrtDeviceApis::CommonsJavaScript;
 using namespace WrtDeviceApis::Commons;
@@ -218,9 +219,9 @@ void SimSpnValueCallback(TapiHandle *handle, int result, void *data, void *user_
 
 }
 
-#define STORAGE_INTERNAL_PATH   "/opt/usr/media"
-#define STORAGE_SDCARD_PATH     "/opt/storage/sdcard"
-#define STORAGE_USBHOST_PATH    "/opt/storage/usb"
+#define STORAGE_INTERNAL_PATH   tzplatform_getenv(TZ_USER_CONTENT)
+#define STORAGE_SDCARD_PATH     tzplatform_mkpath(TZ_SYS_STORAGE,"sdcard")
+#define STORAGE_USBHOST_PATH    tzplatform_mkpath(TZ_SYS_STORAGE,"usb")
 #define DISPLAY_BRIGHTNESS_DIVIDE_VALUE 100
 #define WIFI_SIGNAL_STRENGTH_DIVIDE_VALUE 100
 #define CPU_POWER_DEVICE_VALUE          100