#include <media_util_private.h>
#endif
-static char *g_old_path = NULL;
#define TIZEN_USER_CONTENT_PATH tzplatform_getenv(TZ_USER_CONTENT)
int _media_util_check_file_exist(const char *path)
#else
int ret = MEDIA_CONTENT_ERROR_NONE;
+ char *old_internal_path = NULL;
- if (!STRING_VALID(g_old_path)) {
- ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &g_old_path);
- if (ret != STORAGE_ERROR_NONE) {
- media_content_error("storage_get_directory failed");
- return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- }
+ ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &old_internal_path);
+ if (ret != STORAGE_ERROR_NONE) {
+ media_content_error("storage_get_directory failed");
+ return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
}
- if (strncmp(path, g_old_path, strlen(g_old_path)) == 0) {
+ if (strncmp(path, old_internal_path, strlen(old_internal_path)) == 0) {
media_content_sec_debug("Old path[%s]", path);
- snprintf(replace_path, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), path + strlen(g_old_path));
+ snprintf(replace_path, MAX_PATH_LEN, "%s%s", TIZEN_USER_CONTENT_PATH, path + strlen(old_internal_path));
} else {
snprintf(replace_path, MAX_PATH_LEN, "%s", path);
}
+
+ SAFE_FREE(old_internal_path);
#endif
if (!STRING_VALID(replace_path)) {
#else
int ret = MEDIA_CONTENT_ERROR_NONE;
+ char *old_internal_path = NULL;
- if (!STRING_VALID(g_old_path)) {
- ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &g_old_path);
- if (ret != STORAGE_ERROR_NONE) {
- media_content_error("storage_get_directory failed");
- return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
- }
+ ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &old_internal_path);
+ if (ret != STORAGE_ERROR_NONE) {
+ media_content_error("storage_get_directory failed");
+ return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
}
- if (strncmp(path, tzplatform_getenv(TZ_USER_CONTENT), strlen(tzplatform_getenv(TZ_USER_CONTENT))) == 0) {
+ if (strncmp(path, TIZEN_USER_CONTENT_PATH, strlen(TIZEN_USER_CONTENT_PATH)) == 0) {
media_content_sec_debug("new path[%s]", path);
- snprintf(replace_path, MAX_PATH_LEN, "%s%s", g_old_path, path + strlen(tzplatform_getenv(TZ_USER_CONTENT)));
+ snprintf(replace_path, MAX_PATH_LEN, "%s%s", old_internal_path, path + strlen(TIZEN_USER_CONTENT_PATH));
} else {
snprintf(replace_path, MAX_PATH_LEN, "%s", path);
}
+
+ SAFE_FREE(old_internal_path);
#endif
if (!STRING_VALID(replace_path)) {