X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmedia_util_private.c;h=60f85ee6c856d7c639b3e9dc5f824b1d8f7d0378;hb=91d04a3ff55b3f24d25ba989b12e2cc67639fb64;hp=d11d9268a0a8185e740bed77ef219377ff18e8c7;hpb=392810363ac613a41b96c73c9d87effefe3fabb3;p=platform%2Fcore%2Fapi%2Fmedia-content.git diff --git a/src/media_util_private.c b/src/media_util_private.c index d11d926..60f85ee 100755 --- a/src/media_util_private.c +++ b/src/media_util_private.c @@ -22,10 +22,6 @@ #include #include -#ifdef _USE_SENIOR_MODE -#include -#endif - static int MEDIA_CONTENT_OTHER_SUPPORT = -1; bool _media_util_check_support_media_type(const char *path) @@ -81,35 +77,6 @@ int _media_util_check_file_exist(const char *path) return MEDIA_CONTENT_ERROR_NONE; } -void _media_util_trim_path(const char *input_path, char **output_path) -{ - gchar **name_list = NULL; - gchar *tmp_path = NULL; - - if (!STRING_VALID(input_path) || output_path == NULL) - return; - - /* Workflow example - Input : /a/b//c/ - After g_strsplit() : {'','a','b','','c',''} - After g_build_pathv() : a/b/c - After g_strdup_printf() : /a/b/c - */ - name_list = g_strsplit(input_path, "/", -1); - if (!name_list) - return; - - tmp_path = g_build_pathv(G_DIR_SEPARATOR_S, name_list); - g_strfreev(name_list); - if (!tmp_path) - return; - - /* g_build_pathv does not add root '/' */ - *output_path = g_strdup_printf("/%s", tmp_path); - g_free(tmp_path); -} - - int _media_util_get_file_time(const char *path) { struct stat statbuf; @@ -159,7 +126,7 @@ bool _media_util_is_ignorable_file(const char *path) /* Check symbolic directory */ tmp_path = realpath(path, NULL); /* Get trimmed path */ - _media_util_trim_path(path, &org_path); + org_path = g_canonicalize_filename(path, NULL); #ifdef _USE_TVPD_MODE if (g_strcmp0(tmp_path, org_path) != 0) { @@ -171,7 +138,7 @@ bool _media_util_is_ignorable_file(const char *path) } #else if (g_str_has_prefix(tmp_path, MEDIA_SHARE_PATH)) { - /* If shared dirctory, it should be change path to TZ_USER_SHARE from realpath */ + /* 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)); if (g_strcmp0(replace, org_path) != 0) { content_error("symbolic link(directory)"); @@ -283,7 +250,7 @@ int _media_content_check_dir(const char *path) /* Check symbolic link directory */ real = realpath(path, NULL); /* Get trimmed path */ - _media_util_trim_path(path, &origin); + origin = g_canonicalize_filename(path, NULL); #ifdef _USE_TVPD_MODE if (g_strcmp0(real, origin) != 0) { @@ -295,7 +262,7 @@ int _media_content_check_dir(const char *path) } #else if (g_str_has_prefix(real, MEDIA_SHARE_PATH)) { - /* If shared dirctory, it should be change path to TZ_USER_SHARE from realpath */ + /* 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)); if (g_strcmp0(result_path, origin) != 0) { content_error("symbolic link(directory)"); @@ -320,61 +287,3 @@ int _media_content_check_dir(const char *path) return MEDIA_CONTENT_ERROR_NONE; } - - -/* FIXME : If there are no issue reports related to this, it will be deleted in tizen 6.5 or after. */ -char * _media_content_replace_path_in_condition(const char *condition) -{ - return g_strdup(condition); -#if 0 - char **split_list = NULL; - char *result = NULL; - - if (!STRING_VALID(MEDIA_ROOT_PATH_INTERNAL_OLD) || !STRING_VALID(MEDIA_ROOT_PATH_INTERNAL)) - return NULL; - - content_sec_debug("Old condition[%s]", condition); - - split_list = g_strsplit(condition, MEDIA_ROOT_PATH_INTERNAL_OLD, -1); - if (!split_list) - return NULL; - - result = g_strjoinv(MEDIA_ROOT_PATH_INTERNAL, split_list); - g_strfreev(split_list); - - return result; -#endif -} - -/* FIXME : If there are no issue reports related to this, it will be deleted in Tizen 6.5 or after. */ -int _media_content_replace_path(const char *path, char *replace_path) -{ - content_retip_if_fail(STRING_VALID(path)); - - snprintf(replace_path, MAX_PATH_LEN, "%s", path); -#if 0 - if (strncmp(path, MEDIA_ROOT_PATH_INTERNAL_OLD, strlen(MEDIA_ROOT_PATH_INTERNAL_OLD)) == 0) { - content_sec_debug("Old path[%s]", path); - snprintf(replace_path, MAX_PATH_LEN, "%s%s", MEDIA_ROOT_PATH_INTERNAL, path + strlen(MEDIA_ROOT_PATH_INTERNAL_OLD)); - } else { - snprintf(replace_path, MAX_PATH_LEN, "%s", path); - } -#endif - - return MEDIA_CONTENT_ERROR_NONE; -} - -#ifdef _USE_SENIOR_MODE -bool _media_content_is_support_senior_mode() -{ - bool bSupportSeniorMode = false; - - if (system_info_get_value_bool(SYSTEM_INFO_KEY_GET_SENIOR_MODE_SUPPORTED, &bSupportSeniorMode) != SYSTEM_INFO_ERROR_NONE) { - content_debug("Get senior mode support failed"); - return false; - } - /* content_debug("Senior mode Support : [%d]", bSupportSeniorMode); */ - return bSupportSeniorMode; -} -#endif -