Remove default album info from image type
[platform/core/multimedia/libmedia-service.git] / src / common / media-svc-media-folder.c
index f1f3825..64e9441 100755 (executable)
@@ -18,7 +18,8 @@
  */
 
 #include <glib/gstdio.h>
-#include <media-util-err.h>
+#include <media-util-user.h>
+
 #include "media-svc-media-folder.h"
 #include "media-svc-debug.h"
 #include "media-svc-env.h"
@@ -86,20 +87,9 @@ int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid)
 static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
-       unsigned int next_pos = 0;
+       size_t next_pos = ms_user_get_root_length(path, uid);
        char *next = NULL;
        char *dir_path = NULL;
-       char *internal_path = NULL;
-
-       if (g_str_has_prefix(path, tzplatform_getenv(TZ_SYS_STORAGE))) {
-               next_pos = strlen(tzplatform_getenv(TZ_SYS_STORAGE)) + 1;
-       } else {
-               ret = ms_user_get_internal_root_path(uid, &internal_path);
-               media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get root path");
-
-               next_pos = strlen(internal_path);
-               g_free(internal_path);
-       }
 
        do {
                next = strstr(path + next_pos, "/");