Use ms_user_get_root_length 21/307221/2
authorminje.ahn <minje.ahn@samsung.com>
Wed, 6 Mar 2024 06:17:19 +0000 (15:17 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Wed, 6 Mar 2024 06:29:24 +0000 (15:29 +0900)
Change-Id: I6c08d3849b54e911b62992b12280f44101bcabd2
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
src/common/media-svc-media-folder.c

index f1f3825..8f0903b 100755 (executable)
@@ -86,20 +86,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, "/");