Add API of getting thumbnail store path 05/129805/2 submit/tizen/20170518.232034
authorHaejeong Kim <backto.kim@samsung.com>
Thu, 18 May 2017 06:56:19 +0000 (15:56 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Thu, 18 May 2017 09:38:50 +0000 (18:38 +0900)
Change-Id: Ic080a797a46111b76fb6553e07a91325d8e2576a

lib/include/media-util-user.h
lib/media-util-user.c

index 1335ce9..723314e 100755 (executable)
@@ -32,6 +32,9 @@ typedef enum {
 
 int ms_user_get_internal_root_path(uid_t uid, char **path);
 int ms_user_get_storage_type(uid_t uid, const char *path, ms_user_storage_type_t *storage_type);
+int ms_user_get_root_thumb_store_path(uid_t uid, char **path);
+int ms_user_get_default_thumb_store_path(uid_t uid, char **path);
+int ms_user_get_mmc_thumb_store_path(uid_t uid, char **path);
 
 #ifdef __cplusplus
 }
index 663b05a..9bd06bb 100755 (executable)
@@ -77,3 +77,68 @@ int ms_user_get_storage_type(uid_t uid, const char *path, ms_user_storage_type_t
 
        return ret;
 }
+
+int ms_user_get_root_thumb_store_path(uid_t uid, char **path)
+{
+       int ret = MS_MEDIA_ERR_NONE;
+
+       if (uid == getuid()) {
+               const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb");
+               *path = g_strndup(result, strlen(result));
+       } else {
+               ret = tzplatform_set_user(uid);
+               MSAPI_RETVM_IF(ret != 0, MS_MEDIA_ERR_INTERNAL, "Invalid UID[%d]", uid);
+
+               const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb");
+               *path = g_strndup(result, strlen(result));
+
+               tzplatform_reset_user();
+       }
+
+       //MSAPI_DBG_SLOG("thumb path [%s]", *path);
+
+       return ret;
+}
+int ms_user_get_default_thumb_store_path(uid_t uid, char **path)
+{
+       int ret = MS_MEDIA_ERR_NONE;
+
+       if (uid == getuid()) {
+               const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone");
+               *path = g_strndup(result, strlen(result));
+       } else {
+               ret = tzplatform_set_user(uid);
+               MSAPI_RETVM_IF(ret != 0, MS_MEDIA_ERR_INTERNAL, "Invalid UID[%d]", uid);
+
+               const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone");
+               *path = g_strndup(result, strlen(result));
+
+               tzplatform_reset_user();
+       }
+
+       //MSAPI_DBG_SLOG("thumb path [%s]", *path);
+
+       return ret;
+}
+
+int ms_user_get_mmc_thumb_store_path(uid_t uid, char **path)
+{
+       int ret = MS_MEDIA_ERR_NONE;
+
+       if (uid == getuid()) {
+               const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc");
+               *path = g_strndup(result, strlen(result));
+       } else {
+               ret = tzplatform_set_user(uid);
+               MSAPI_RETVM_IF(ret != 0, MS_MEDIA_ERR_INTERNAL, "Invalid UID[%d]", uid);
+
+               const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc");
+               *path = g_strndup(result, strlen(result));
+
+               tzplatform_reset_user();
+       }
+
+       //MSAPI_DBG_SLOG("thumb path [%s]", *path);
+
+       return ret;
+}