}
}
+static char *mf_storage_file_get(const char path[])
+{
+ char *file = NULL;
+ if ((file = strrchr(path, '/'))) {
+ file++;
+ } else {
+ file = (char *) path;
+ }
+
+ return file;
+}
+
static bool mf_file_get_all_supported_storage_cb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData)
{
char *temp_path = g_strdup(path);
return storage_path;
}
+static inline char *Get_Storage_Name(storage_mode_e smode)
+{
+ char *sname = NULL;
+ char *path = NULL;
+ int error_code = storage_foreach_device_supported(mf_file_get_all_supported_storage_cb, NULL);
+ if (error_code != STORAGE_ERROR_NONE) {
+ mf_error("failed to get storage Id");
+ return NULL;
+ }
+
+ if (smode == DEVICE) {
+ if (device_id != -1) {
+ storage_get_root_directory(device_id, &path);
+ if (path) {
+ sname = mf_storage_file_get(path);
+ mf_debug("Phone Name : %s", sname);
+ }
+ }
+ } else if (smode == MMC) {
+ if (mmc_id != -1) {
+ storage_get_root_directory(mmc_id, &path);
+ if (path) {
+ sname = mf_storage_file_get(path);
+ mf_debug("MMC Name : %s", sname);
+ }
+ }
+#ifdef MYFILE_USB_OTG
+ } else if (smode == OTG) {
+ if (otg_id != -1) {
+ storage_get_root_directory(otg_id, &path);
+ if (path) {
+ sname = mf_storage_file_get(path);
+ mf_debug("OTG Name : %s", sname);
+ }
+ }
+#endif
+ }
+
+ return sname;
+}
+
#define DEBUG_FOLDER "SLP_debug"
/* File system related value definition */
#define MEMORY_FOLDER Get_Root_Path(STORAGE_TYPE_EXTERNAL, MMC)
#define PHONE_PARENT Get_Parent_Path(STORAGE_TYPE_INTERNAL)
#define STORAGE_PARENT Get_Parent_Path(STORAGE_TYPE_EXTERNAL)
-#define PHONE_NAME "content"
-#define MMC_NAME "sdcard"
+#define PHONE_NAME Get_Storage_Name(DEVICE)
+#define MMC_NAME Get_Storage_Name(MMC)
#ifdef MYFILE_USB_OTG
#define OTG_FOLDER Get_Root_Path(STORAGE_TYPE_EXTERNAL, OTG)
-#define OTG_NAME "usb"
+#define OTG_NAME Get_Storage_Name(OTG)
#endif
#define MYFILE_NAME_PATTERN "[\\<>:;*\"|?/]"
real_name = g_strconcat(pNode->path, "/", pNode->name, NULL);
if (real_name) {
- if (strstr(real_name, "sdcard")) {
+ char *temp_path = g_strdup(real_name);
+ mf_util_to_lower(temp_path);
+ if (strstr(temp_path, "sdcard")) {
if (!strcmp(pNode->name, PHONE_NAME)) {
real_name = g_strdup(PHONE_FOLDER);
} else if (!strcmp(pNode->name, MMC_NAME)) {
real_name = g_strdup(MEMORY_FOLDER);
}
- } else if (strstr(real_name, "usb")) {
+ } else if (strstr(temp_path, "usb")) {
if (!strcmp(pNode->name, PHONE_NAME)) {
real_name = g_strdup(PHONE_FOLDER);
} else if (!strcmp(pNode->name, OTG_NAME)) {
real_name = g_strdup(OTG_FOLDER);
}
}
+ SAFE_FREE_G_CHAR(temp_path);
} else {
mf_error("mount path is NULL");
return NULL;