Remove hardcoded path for multiuser support sandbox/sdi2/multiuser
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Mon, 10 Feb 2014 14:11:37 +0000 (15:11 +0100)
committerSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Mon, 10 Feb 2014 14:11:37 +0000 (15:11 +0100)
bug-tizen: PTREL-189

Signed-off-by: Sabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
packaging/libmedia-service.spec
test/CMakeLists.txt
test/media-service-test.c
test/plugin/media_svc_plugin_test.c

index f3e5c99..646b79e 100755 (executable)
@@ -22,6 +22,7 @@ BuildRequires:  pkgconfig(mm-fileinfo)
 BuildRequires:  pkgconfig(media-thumbnail)
 BuildRequires:  pkgconfig(drm-client)
 BuildRequires:  pkgconfig(libmedia-utils)
+BuildRequires:  pkgconfig(libtzplatform-config)
 
 %description
 Media information service library for multimedia applications
index bc924e5..eb0dd53 100755 (executable)
@@ -2,7 +2,7 @@ SET(fw_name "media-service")
 SET(fw_test "${fw_name}-test")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog libmedia-utils)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog libmedia-utils libtzplatform-config)
 FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
index 3d7a51a..25711cc 100644 (file)
@@ -61,7 +61,8 @@ gboolean _send_noti_batch_operations(gpointer data)
     media_db_update_subscribe(_noti_cb, (void*)user_str);
 
     /* 1. media_svc_insert_item_immediately */
-    char *path = "/opt/usr/media/test/image1.jpg";
+    char *path;
+    strcpy(path, tzplatform_mkpath(TZ_USER_CONTENT, "test/image1.jpg"));
 
        media_svc_storage_type_e storage_type;
 
@@ -78,7 +79,7 @@ gboolean _send_noti_batch_operations(gpointer data)
        //ret = media_svc_insert_item_begin(g_db_handle, 100);
        for (i = 0; i < 16; i++) {
                char filepath[255] = {0,};
-               snprintf(filepath, sizeof(filepath), "%s%d.jpg", "/opt/usr/media/test/image", i+1);
+               snprintf(filepath, sizeof(filepath), "%s%d.jpg", tzplatform_mkpath(TZ_USER_CONTENT,"test/image"), i+1);
                media_svc_debug("File : %s\n", filepath);
                file_list[i] = strdup(filepath);
                ret = media_svc_insert_item_bulk(g_db_handle, storage_type, file_list[i], FALSE);
@@ -104,7 +105,8 @@ gboolean _send_noti_operations(gpointer data)
        media_db_update_subscribe(_noti_cb, (void*)user_str);
 
        /* 1. media_svc_insert_item_immediately */
-       char *path = "/opt/usr/media/test/image1.jpg";
+       char *path;
+       strcpy(path, tzplatform_mkpath(TZ_USER_CONTENT,"test/image1.jpg"));
        media_svc_storage_type_e storage_type;
 
        ret = media_svc_get_storage_type(path, &storage_type);
@@ -130,7 +132,8 @@ gboolean _send_noti_operations(gpointer data)
        media_svc_debug("media_svc_refresh_item success");
 
        /* 2. media_svc_move_item */
-       const char *dst_path = "/opt/usr/media/test/image11.jpg";
+       const char *dst_path;
+       strcpy(tzplatform_mkpath(TZ_USER_CONTENT, "test/image11.jpg"));
        ret = media_svc_move_item(g_db_handle, storage_type, path, storage_type, dst_path);
        if (ret < MEDIA_INFO_ERROR_NONE) {
                media_svc_error("media_svc_move_item failed : %d", ret);
@@ -154,8 +157,10 @@ gboolean _send_noti_operations(gpointer data)
        media_svc_debug("media_svc_delete_item_by_path success");
 
        /* Rename folder */
-       const char *src_folder_path = "/opt/usr/media/test";
-       const char *dst_folder_path = "/opt/usr/media/test_test";
+       const char *src_folder_path;
+       strcpy(src_folder_path, tzplatform_mkpath(TZ_USER_CONTENT, "test"));
+       const char *dst_folder_path;
+       strcpy(dst_folder_path,tzplatform_mkpath(TZ_USER_CONTENT,"test_test"));
        ret = media_svc_rename_folder(g_db_handle, src_folder_path, dst_folder_path);
        if (ret < MEDIA_INFO_ERROR_NONE) {
                media_svc_error("media_svc_rename_folder failed : %d", ret);
index eb4023f..71ce3cb 100755 (executable)
 #include <dlfcn.h>
 #include <media-svc.h>
 
+#include <tzplatform_config.h>
+
 #define PLUGIN_SO_FILE_NAME  "/usr/lib/libmedia-content-plugin.so"
+#define MEDIA_ROOT_PATH_SDCARD tzplatform_mkpath(TZ_SYS_STORAGE,"sdcard")
 void *funcHandle = NULL;
 
 static void msg_print(int line, char *msg);
@@ -97,7 +100,7 @@ int main()
        }
 
        //check_item ================================================
-       ret = svc_check_item("/opt/usr/media/Music/Over the horizon.mp3", "audio/mpeg", &err_msg);
+       ret = svc_check_item(tzplatform_mkpath(TZ_USER_CONTENT,"Music/Over the horizon.mp3"), "audio/mpeg", &err_msg);
        if(ret < 0) {
                msg_print(__LINE__, "svc_check_item error");
                if(err_msg != NULL) {
@@ -138,7 +141,7 @@ int main()
 #if 1
        while (1) {
 
-       printf("Enter path and mimetype ( ex. /opt/usr/media/a.jpg image ) : ");
+       printf("Enter path and mimetype ( ex. %s/a.jpg image ) : ", tzplatform_mkpath(TZ_USER_CONTENT,""));
        scanf("%s %s", path, type);
 
        //check_item_exist ============================================
@@ -181,7 +184,8 @@ int main()
 #endif
 
        //folder test ==================================================
-       char *folder_path = "/opt/usr/media/Sounds";
+       char *folder_path;
+       strcpy(folder_path,tzplatform_mkpath(TZ_USER_CONTENT,"Sounds"));
        ret = svc_set_folder_item_validity(db_handle, folder_path, 0, 1, &err_msg);
        if(ret < 0) {
                msg_print(__LINE__, "svc_set_folder_item_validity error");