From: Sabera Djelti (sdi2) Date: Wed, 12 Feb 2014 16:25:36 +0000 (+0100) Subject: Remove hardcoded path for multiuser support X-Git-Tag: submit/tizen_common/20140521.163740^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fsystem%2Fsync-agent.git;a=commitdiff_plain;h=65d4fdceb1d079d92b794bcf47684ddc8e8b7307 Remove hardcoded path for multiuser support Change-Id: I47f9455d66002ba870cf16dab95951d671800175 Bug-Tizen: PTREL-273 Signed-off-by: Sabera Djelti (sdi2) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b85c4b4..6ca88fb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,4 +24,3 @@ ADD_DEFINITIONS("-DLOG_TAG=\"SYNC_AGENT\"") # include source files ADD_SUBDIRECTORY(src/framework) ADD_SUBDIRECTORY(src/fw-plugins) - diff --git a/TC/testcase/fw-test-cfg/test_fw_config.xml b/TC/testcase/fw-test-cfg/test_fw_config.xml.in similarity index 100% rename from TC/testcase/fw-test-cfg/test_fw_config.xml rename to TC/testcase/fw-test-cfg/test_fw_config.xml.in diff --git a/packaging/sync-agent.spec b/packaging/sync-agent.spec index 8bf470f..127934f 100755 --- a/packaging/sync-agent.spec +++ b/packaging/sync-agent.spec @@ -42,7 +42,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: libgcrypt-devel BuildRequires: cmake BuildRequires: pkgconfig(dbus-glib-1) - +BuildRequires: pkgconfig(libtzplatform-config) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 372b2fe..e7ce09c 100755 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -28,6 +28,7 @@ pkg_check_modules(LPKGS REQUIRED dlog dbus-glib-1 sysman + libtzplatform-config ) ############################################# diff --git a/src/framework/device-manager/mo_accessor.c b/src/framework/device-manager/mo_accessor.c index a4fd76e..442f679 100755 --- a/src/framework/device-manager/mo_accessor.c +++ b/src/framework/device-manager/mo_accessor.c @@ -32,6 +32,8 @@ #include #include +#include + #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) #endif @@ -65,7 +67,7 @@ EXPORT_API sync_agent_dm_mo_error_e sync_agent_open_mo() _EXTERN_FUNC_EXIT; - return dm_mo_open("/opt/usr/dbspace/.momanager.db"); + return dm_mo_open((char*)tzplatform_mkpath(TZ_USER_DB,".momanager.db")); } EXPORT_API sync_agent_dm_mo_error_e sync_agent_close_mo() diff --git a/src/framework/event/oma_ds_api.c b/src/framework/event/oma_ds_api.c index 44992c1..d5b181f 100755 --- a/src/framework/event/oma_ds_api.c +++ b/src/framework/event/oma_ds_api.c @@ -33,6 +33,8 @@ #include "utility/sync_util.h" #include "initialization/initialization.h" +#include + #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) #endif @@ -545,7 +547,7 @@ EXPORT_API sync_agent_ds_error_e sync_agent_ds_init() int pid = -1; _DEBUG_INFO("before sysman_get_pid"); - pid = sysman_get_pid("/usr/bin/oma-ds-agent"); + pid = sysman_get_pid(tzplatform_mkpath(TZ_SYS_BIN,"oma-ds-agent")); _DEBUG_INFO("oma-ds-agent pid [%d]", pid); if(pid == -1 ) { diff --git a/src/framework/fsapi/operation.c b/src/framework/fsapi/operation.c index 0bdb036..7f666b4 100755 --- a/src/framework/fsapi/operation.c +++ b/src/framework/fsapi/operation.c @@ -30,6 +30,8 @@ #include "utility/sync_util.h" +#include + #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) #endif @@ -81,7 +83,7 @@ EXPORT_API sync_agent_fsapi_return_e sync_agent_get_fs_info(char **result) int allow_dup_name = 0; int folder_depth_max = 15; - ret = sync_agent_get_fs_mem_size("/opt/usr/media", &free_size, &total_size); + ret = sync_agent_get_fs_mem_size(tzplatform_getenv(TZ_USER_CONTENT), &free_size, &total_size); if (!ret) { _DEBUG_ERROR("[sync_agent_get_fs_info] getting mem size fail"); return SYNC_AGENT_FSAPI_FALSE; diff --git a/src/framework/utility/fw_file.c b/src/framework/utility/fw_file.c index 66e4c23..a68cf9b 100755 --- a/src/framework/utility/fw_file.c +++ b/src/framework/utility/fw_file.c @@ -23,6 +23,8 @@ #include "fsapi/operation.h" +#include + #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) #endif @@ -32,7 +34,7 @@ #define LOG_TAG "AF_UTIL_FILE" #endif -#define UTIL_DEFAULT_ACCOUNT_PLUGIN_FOLDER "/opt/data/sync-agent/db" +#define UTIL_DEFAULT_ACCOUNT_PLUGIN_FOLDER tzplatform_mkpath(TZ_SYS_DATA,"sync-agent/db") EXPORT_API int sync_agent_set_int_into_file(char *file_path, int value) { diff --git a/src/fw-plugins/common-public/call-log/CMakeLists.txt b/src/fw-plugins/common-public/call-log/CMakeLists.txt index e586bd2..9f7b242 100755 --- a/src/fw-plugins/common-public/call-log/CMakeLists.txt +++ b/src/fw-plugins/common-public/call-log/CMakeLists.txt @@ -14,7 +14,8 @@ PROJECT(plugin-${PLUGIN_NAME}) INCLUDE(FindPkgConfig) pkg_check_modules(${PLUGIN_NAME} REQUIRED contacts-service2 - dlog) + dlog + libtzplatform-config) ############################################# # @@ -37,4 +38,4 @@ SET(PLUGIN_LDFLAGS "${da-call-log_LDFLAGS}") # Step 4. Install packages # -include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.sub) \ No newline at end of file +include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.sub) diff --git a/src/fw-plugins/common-public/call-log/src/plugin_interface.c b/src/fw-plugins/common-public/call-log/src/plugin_interface.c index d69f798..ee8bd53 100755 --- a/src/fw-plugins/common-public/call-log/src/plugin_interface.c +++ b/src/fw-plugins/common-public/call-log/src/plugin_interface.c @@ -27,7 +27,9 @@ #include "plugin/data_connector_interface.h" -#define BACKUP_PATH "/opt/usr/media/Downloads/Kies/.BnR/CallLog.bk" +#include + +#define BACKUP_PATH tzplatform_mkpath(TZ_USER_CONTENT,"Downloads/Kies/.BnR/CallLog.bk") #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) diff --git a/src/fw-plugins/common-public/slp-sysnoti-wap-push/CMakeLists.txt b/src/fw-plugins/common-public/slp-sysnoti-wap-push/CMakeLists.txt index cccece0..e05b934 100755 --- a/src/fw-plugins/common-public/slp-sysnoti-wap-push/CMakeLists.txt +++ b/src/fw-plugins/common-public/slp-sysnoti-wap-push/CMakeLists.txt @@ -16,7 +16,8 @@ pkg_check_modules(${PLUGIN_NAME} REQUIRED glib-2.0 vconf msg-service - dlog) + dlog + libtzplatform-config) ############################################# # diff --git a/src/fw-plugins/common-public/slp-sysnoti-wap-push/src/plugin_interface.c b/src/fw-plugins/common-public/slp-sysnoti-wap-push/src/plugin_interface.c index ba59872..47619e4 100755 --- a/src/fw-plugins/common-public/slp-sysnoti-wap-push/src/plugin_interface.c +++ b/src/fw-plugins/common-public/slp-sysnoti-wap-push/src/plugin_interface.c @@ -37,6 +37,8 @@ /* for log */ #include "utility/sync_util.h" +#include + #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) #endif @@ -46,8 +48,8 @@ #define LOG_TAG "PLUGIN_PM_SYSNOTI_WAP_PUSH" #endif -#define CP_HEADER_DATA_PATH "/opt/data/header_log.wbxml" -#define CP_BODY_DATA_PATH "/opt/data/body_log.wbxml" +#define CP_HEADER_DATA_PATH tzplatform_mkpath(TZ_SYS_DATA,"header_log.wbxml") +#define CP_BODY_DATA_PATH tzplatform_mkpath(TZ_SYS_DATA,"body_log.wbxml") static msg_handle_t msg_handle = NULL; diff --git a/src/fw-plugins/common-public/vcalendar-task/CMakeLists.txt b/src/fw-plugins/common-public/vcalendar-task/CMakeLists.txt index 80048d6..9812290 100755 --- a/src/fw-plugins/common-public/vcalendar-task/CMakeLists.txt +++ b/src/fw-plugins/common-public/vcalendar-task/CMakeLists.txt @@ -17,7 +17,8 @@ pkg_check_modules(${PLUGIN_NAME} REQUIRED calendar-service2 glib-2.0 icu-i18n - dlog) + dlog + libtzplatform-config) ############################################# # @@ -40,4 +41,4 @@ SET(PLUGIN_LDFLAGS "${dc-vcalendar-task_LDFLAGS}") # Step 4. Install packages # -include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.sub) \ No newline at end of file +include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.sub) diff --git a/src/fw-plugins/common-public/vcalendar-task/include/vcalendar_string_util.h b/src/fw-plugins/common-public/vcalendar-task/include/vcalendar_string_util.h index 95af547..dbcfc1d 100755 --- a/src/fw-plugins/common-public/vcalendar-task/include/vcalendar_string_util.h +++ b/src/fw-plugins/common-public/vcalendar-task/include/vcalendar_string_util.h @@ -33,6 +33,8 @@ #include "utility/sync_util.h" +#include + typedef enum task_date_type { TASK_DATE_TYPE_ONTIME = 0, TASK_DATE_TYPE_YEAR, @@ -94,11 +96,11 @@ typedef enum task_date_type { #define IMAGE_KEYWORD_BEGIN_PATH "PATH=3D" #define IMAGE_KEYWORD_END_PATH "=3bDATE=3D\r\n" -#define INTERNAL_MEMORY_ORIGIN "/opt/usr/media" +#define INTERNAL_MEMORY_ORIGIN tzplatform_getenv(TZ_USER_CONTENT) #define INTERNAL_MEMORY_CONVERTED "Internal=3a" -#define EXTERNAL_MEMORY_ORIGIN "/opt/storage/sdcard" +#define EXTERNAL_MEMORY_ORIGIN tzplatform_mkpath(TZ_SYS_STORAGE,"sdcard") #define EXTERNAL_MEMORY_CONVERTED "External=3a" -#define SNOTE_MEMORY_ORIGIN "/opt/usr/apps/com.samsung.smemo/data/" +#define SNOTE_MEMORY_ORIGIN tzplatform_mkpath(TZ_USER_APP,"com.samsung.smemo/data/") char * get_value_by_token(const char *src, const char *token, const char *end_of_token); char * replace_string(char *origin, const char *src, const char *dest); diff --git a/src/fw-plugins/common-public/vcalendar/CMakeLists.txt b/src/fw-plugins/common-public/vcalendar/CMakeLists.txt index 8730e01..5cf262d 100755 --- a/src/fw-plugins/common-public/vcalendar/CMakeLists.txt +++ b/src/fw-plugins/common-public/vcalendar/CMakeLists.txt @@ -17,7 +17,8 @@ pkg_check_modules(${PLUGIN_NAME} REQUIRED calendar-service2 glib-2.0 icu-i18n - dlog) + dlog + libtzplatform-config) ############################################# # @@ -40,4 +41,4 @@ SET(PLUGIN_LDFLAGS "${dc-vcalendar_LDFLAGS}") # Step 4. Install packages # -include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.sub) \ No newline at end of file +include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.sub) diff --git a/src/fw-plugins/common-public/vcalendar/include/vcalendar_string_util.h b/src/fw-plugins/common-public/vcalendar/include/vcalendar_string_util.h index 385ffa2..e968cf4 100755 --- a/src/fw-plugins/common-public/vcalendar/include/vcalendar_string_util.h +++ b/src/fw-plugins/common-public/vcalendar/include/vcalendar_string_util.h @@ -34,6 +34,8 @@ #include "utility/sync_util.h" #include "data-adapter/error.h" +#include + typedef enum cal_date_type { CALENDAR_DATE_TYPE_ONTIME = 0, CALENDAR_DATE_TYPE_YEAR, @@ -100,11 +102,11 @@ struct sync_agent_calendar_exdate_s { #define IMAGE_KEYWORD_BEGIN_PATH "PATH=3D" #define IMAGE_KEYWORD_END_PATH "=3bDATE=3D\r\n" -#define INTERNAL_MEMORY_ORIGIN "/opt/usr/media" +#define INTERNAL_MEMORY_ORIGIN tzplatform_getenv(TZ_USER_CONTENT) #define INTERNAL_MEMORY_CONVERTED "Internal=3a" -#define EXTERNAL_MEMORY_ORIGIN "/opt/storage/sdcard" +#define EXTERNAL_MEMORY_ORIGIN tzplatform_mkpath(TZ_SYS_STORAGE,"sdcard") #define EXTERNAL_MEMORY_CONVERTED "External=3a" -#define SNOTE_MEMORY_ORIGIN "/opt/usr/apps/com.samsung.smemo/data/" +#define SNOTE_MEMORY_ORIGIN tzplatform_mkpath(TZ_USER_APP,"com.samsung.smemo/data/") #define EXDATE_LENGTH 16 // length of "20130211T000000Z" diff --git a/test/dummy_project/packaging/dummy-agent.spec b/test/dummy_project/packaging/dummy-agent.spec index 37089be..34c27ec 100755 --- a/test/dummy_project/packaging/dummy-agent.spec +++ b/test/dummy_project/packaging/dummy-agent.spec @@ -14,7 +14,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(sqlite3) BuildRequires: expat-devel BuildRequires: cmake - +BuildRequires: pkgconfig(libtzplatform-config) %description dummy-agent daemon (development headers) @@ -63,7 +63,7 @@ rm -rf /usr/share/oma-ds-cfg %manifest dummy-agent.manifest %defattr(-,root,root,-) -/usr/bin/dummy-agent +%TZ_SYS_BIN/dummy-agent /usr/share/dummy-cfg/*