external: add function to get specific directories 31/67731/3
authorTaeyoung Kim <ty317.kim@samsung.com>
Thu, 28 Apr 2016 06:57:17 +0000 (15:57 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Fri, 29 Apr 2016 01:28:25 +0000 (18:28 -0700)
- The specific directories are under the root path
  of external storage.
- Ringtone path is not supported on external storages.

Change-Id: Ie7e13d19a30dbe8e6b874eba98f498c81c5da0a0
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
src/storage.c

index 7f56f52..41a3b3b 100644 (file)
@@ -167,7 +167,18 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
        }
 
        /* external storage */
-       return STORAGE_ERROR_NONE;
+       if (type == STORAGE_DIRECTORY_SYSTEM_RINGTONES) {
+               _E("Not support directory : id(%d) type(%d)", storage_id, type);
+               return STORAGE_ERROR_NOT_SUPPORTED;
+       }
+
+       ret = storage_ext_get_root(storage_id, root, sizeof(root));
+       if (ret < 0) {
+               _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret);
+               return STORAGE_ERROR_OPERATION_FAILED;
+       }
+
+       snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type]);
 
 out:
        *path = strdup(temp);