From: pr.jung Date: Thu, 11 May 2017 11:43:06 +0000 (+0900) Subject: Use tzplatform-config for storage_get_directory X-Git-Tag: submit/tizen/20170511.114720^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8291f86520608ea2237374944b477548bbb1097f;p=platform%2Fcore%2Fsystem%2Flibstorage.git Use tzplatform-config for storage_get_directory Change-Id: Ic079a84945fa0c6f55367c9d4c90321b7b2133cc Signed-off-by: pr.jung --- diff --git a/src/storage.c b/src/storage.c index fa719ec..598a289 100644 --- a/src/storage.c +++ b/src/storage.c @@ -20,22 +20,24 @@ #include #include #include +#include #include "common.h" #include "list.h" #include "log.h" #include "storage-external.h" -const char *dir_path[STORAGE_DIRECTORY_MAX] = { - [STORAGE_DIRECTORY_IMAGES] = "Images", - [STORAGE_DIRECTORY_SOUNDS] = "Sounds", - [STORAGE_DIRECTORY_VIDEOS] = "Videos", - [STORAGE_DIRECTORY_CAMERA] = "DCIM", - [STORAGE_DIRECTORY_DOWNLOADS] = "Downloads", - [STORAGE_DIRECTORY_MUSIC] = "Music", - [STORAGE_DIRECTORY_DOCUMENTS] = "Documents", - [STORAGE_DIRECTORY_OTHERS] = "Others", - [STORAGE_DIRECTORY_SYSTEM_RINGTONES] = "", +const char *dir_path[STORAGE_DIRECTORY_MAX]; + +const int tz_id[STORAGE_DIRECTORY_MAX] = { + [STORAGE_DIRECTORY_IMAGES] = TZ_USER_IMAGES, + [STORAGE_DIRECTORY_SOUNDS] = TZ_USER_SOUNDS, + [STORAGE_DIRECTORY_VIDEOS] = TZ_USER_VIDEOS, + [STORAGE_DIRECTORY_CAMERA] = TZ_USER_CAMERA, + [STORAGE_DIRECTORY_DOWNLOADS] = TZ_USER_DOWNLOADS, + [STORAGE_DIRECTORY_MUSIC] = TZ_USER_MUSIC, + [STORAGE_DIRECTORY_DOCUMENTS] = TZ_USER_DOCUMENTS, + [STORAGE_DIRECTORY_OTHERS] = TZ_USER_OTHERS, }; static dd_list *st_int_head; /* Internal storage list */ @@ -525,3 +527,21 @@ API int storage_unset_changed_cb(storage_type_e type, storage_changed_cb callbac return STORAGE_ERROR_NONE; } + +static void __CONSTRUCTOR__ init(void) +{ + const char *tmp; + char *token; + int i; + + for (i = 0 ; i <= STORAGE_DIRECTORY_OTHERS ; i++) { + tmp = tzplatform_getenv(tz_id[i]); + if (tmp != NULL) { + token = rindex(tmp, '/'); + if (token != NULL) { + token++; + dir_path[i] = strdup(token); + } + } + } +}