Use tzplatform API directly
[platform/core/api/media-content.git] / src / media_util_private.c
index 60f85ee..52c65de 100755 (executable)
@@ -18,7 +18,6 @@
 #include <dirent.h>
 #include <fcntl.h>
 #include <media_info_private.h>
-#include <storage.h>
 #include <system_info.h>
 #include <sys/stat.h>
 
@@ -137,9 +136,9 @@ bool _media_util_is_ignorable_file(const char *path)
                return true;
        }
 #else
-       if (g_str_has_prefix(tmp_path, MEDIA_SHARE_PATH)) {
+       if (g_str_has_prefix(tmp_path, tzplatform_getenv(TZ_SYS_MEDIASHARED))) {
                /* If shared directory, it should be change path to TZ_USER_SHARE from realpath */
-               snprintf(replace, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_USER_MEDIASHARED), tmp_path + strlen(MEDIA_SHARE_PATH));
+               snprintf(replace, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_USER_MEDIASHARED), tmp_path + strlen(tzplatform_getenv(TZ_SYS_MEDIASHARED)));
                if (g_strcmp0(replace, org_path) != 0) {
                        content_error("symbolic link(directory)");
                        content_sec_debug("path[%s] real[%s]", org_path, tmp_path);
@@ -186,9 +185,9 @@ static bool __is_scan_ignore_exist(const char *path)
 bool _media_util_is_ignorable_dir(const char *dir_path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
 
-       content_retip_if_fail(STRING_VALID(dir_path));
+       if (!STRING_VALID(dir_path))
+               return true;
 
        content_sec_debug("dir_path : %s", dir_path);
 
@@ -199,10 +198,9 @@ bool _media_util_is_ignorable_dir(const char *dir_path)
        }
 
        /*2. Check Scan Ignore Directory*/
-       ret = ms_user_get_storage_type(_content_get_uid(), dir_path, &storage_type);
-       if (ret != MS_MEDIA_ERR_NONE) {
-               content_error("ms_user_get_storage_type failed : %d", ret);
-               return false;
+       if (!ms_user_is_valid_path(_content_get_uid(), dir_path)) {
+               content_error("ms_user_is_valid_path failed : %d", ret);
+               return true;
        }
 
        char *leaf_path = NULL;
@@ -261,9 +259,9 @@ int _media_content_check_dir(const char *path)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 #else
-       if (g_str_has_prefix(real, MEDIA_SHARE_PATH)) {
+       if (g_str_has_prefix(real, tzplatform_getenv(TZ_SYS_MEDIASHARED))) {
                /* If shared directory, it should be change path to TZ_USER_SHARE from realpath */
-               snprintf(result_path, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_USER_MEDIASHARED), real + strlen(MEDIA_SHARE_PATH));
+               snprintf(result_path, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_USER_MEDIASHARED), real + strlen(tzplatform_getenv(TZ_SYS_MEDIASHARED)));
                if (g_strcmp0(result_path, origin) != 0) {
                        content_error("symbolic link(directory)");
                        content_sec_debug("path[%s] real[%s]", origin, real);