char *_gl_get_root_directory_path(int storage_type);
void _gl_set_launch_state_preference(void *data);
bool _gl_get_launch_state_preference();
+char * _gl_get_camera_folder_path_internal(void);
+char * _gl_get_camera_folder_path_external(void);
+char *_gl_get_downloads_folder_path(void);
#ifdef __cplusplus
}
{
GL_CHECK_FALSE(album);
GL_CHECK_FALSE(album->display_name);
-
-#define GL_DCIM "DCIM"
/* Name is 'Camera' folder locates in Phone */
if (!g_strcmp0(album->display_name, GL_STR_ALBUM_CAMERA)) {
- char *parent_path = (char *)calloc(1, GL_DIR_PATH_LEN_MAX);
- GL_CHECK_FALSE(parent_path);
-
char *root = NULL;
if (album->type == GL_STORE_T_PHONE) {
- root = _gl_get_root_directory_path(STORAGE_TYPE_INTERNAL);
+ root = _gl_get_camera_folder_path_internal();
} else {
- root = _gl_get_root_directory_path(STORAGE_TYPE_EXTERNAL);
+ root = _gl_get_camera_folder_path_external();
}
if (!root) {
- GL_GFREE(parent_path);
- return false;
- }
- gl_sdbg("Full path: %s", album->path);
- _gl_data_util_get_file_dir_name(album->path, NULL, NULL,
- parent_path);
- gl_sdbg("Parent path: %s.", parent_path);
-
- char *dcim_path = g_strdup_printf("%s/%s", root, GL_DCIM);
- if (dcim_path == NULL) {
- GL_GFREE(parent_path);
return false;
}
/* And parent folder is Phone root path, it's default folder */
- bool ret = false;
- ret = !g_strcmp0(dcim_path, parent_path);
-
- GL_GFREE(root);
- GL_GFREE(parent_path);
- GL_GFREE(dcim_path);
- return ret;
+ if (!g_strcmp0(root, album->path)) {
+ GL_GFREE(root);
+ return true;
+ }
}
-
return false;
}
#include "gl-thumbs.h"
#include "gl-data.h"
+static int __externalStorageId = -1;
+static int __internalStorageId = 0;
+
#define GL_FILE_COPY_BUF_MAX 16384
/* Time for displaying progressbar UI compeletely */
#define GL_TIMER_INTERVAL_PBAR_SHOWED 0.5
gl_appdata *ad = (gl_appdata *)data;
if (type == STORAGE_TYPE_EXTERNAL) {
+ __externalStorageId = storageId;
ad->maininfo.externalStorageId = storageId;
return false;
}
return strdup(edj_path);
}
+static char *__gl_get_folder_path(int storage_id, int directory)
+{
+ char *path = NULL;
+ if (storage_id != -1) {
+ char *path_camera = NULL;
+ storage_get_directory(storage_id, directory, &path_camera);
+ if (path_camera) {
+ path = strdup(path_camera);
+ GL_FREEIF(path_camera);
+ } else {
+ path = strdup("");
+ }
+ } else {
+ path = strdup("");
+ }
+ return path;
+}
+
+char * _gl_get_camera_folder_path_internal(void)
+{
+ return __gl_get_folder_path(__internalStorageId, STORAGE_DIRECTORY_CAMERA);
+}
+
+char * _gl_get_camera_folder_path_external(void)
+{
+ return __gl_get_folder_path(__externalStorageId, STORAGE_DIRECTORY_CAMERA);
+}
+
+char *_gl_get_downloads_folder_path(void)
+{
+ return __gl_get_folder_path(__internalStorageId, STORAGE_DIRECTORY_DOWNLOADS);
+}
+
+
char *_gl_get_directory_path(int storage_directory_type)
{
char *path = NULL;