summaryrefslogtreecommitdiff
path: root/tizen/src/emul_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'tizen/src/emul_state.c')
-rw-r--r--tizen/src/emul_state.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c
index eff41e8ee5..54e076bf1a 100644
--- a/tizen/src/emul_state.c
+++ b/tizen/src/emul_state.c
@@ -588,14 +588,57 @@ const char* get_vm_data_path(void)
return vm_data_path;
}
+static int compare_version(const char* version1, const char* version2)
+{
+ int res = 0;
+ char *ver1 = strdup(version1);
+ char *ver2 = strdup(version2);
+ char *remove1 = ver1;
+ char *remove2 = ver2;
+ char *next1 = ver1;
+ char *next2 = ver2;
+
+ while (*next1 != '\0' && *next2 != '\0') {
+ long num1 = strtol(ver1, &next1, 10);
+ long num2 = strtol(ver2, &next2, 10);
+
+ res = num1 - num2;
+ if (res) {
+ break;
+ }
+
+ if (*next1 == '\0' || *next2 == '\0') {
+ res = *next1 - *next2;
+ break;
+ }
+ ver1 = next1 + 1;
+ ver2 = next2 + 1;
+ }
+
+ free(remove1);
+ free(remove2);
+ return res;
+}
+
const char *get_sdcard_image_path(void)
{
+ const gchar *sdcard_rel_path;
const char *vm_data_path = get_vm_data_path();
+ const char *vm_platform_version = get_platform_version();
+ // Since tizen-3.0, vfat SDCard images are used instead of ext4. (+6 for "tizen-")
+ if (compare_version(vm_platform_version + 6, "3.0") >= 0) {
+#ifndef CONFIG_WIN32
+ sdcard_rel_path = g_strdup_printf("%s/../../sdcard/vfat/", vm_data_path);
+#else
+ sdcard_rel_path = g_strdup_printf("%s\\..\\..\\sdcard\\vfat\\", vm_data_path);
+#endif
+ } else {
#ifndef CONFIG_WIN32
- const gchar* sdcard_rel_path = g_strdup_printf("%s/../../sdcard/", vm_data_path);
+ sdcard_rel_path = g_strdup_printf("%s/../../sdcard/", vm_data_path);
#else
- const gchar* sdcard_rel_path = g_strdup_printf("%s\\..\\..\\sdcard\\", vm_data_path);
+ sdcard_rel_path = g_strdup_printf("%s\\..\\..\\sdcard\\", vm_data_path);
#endif
+ }
char sdcard_abs_path[PATH_MAX + 1];
char *ptr = realpath(sdcard_rel_path, sdcard_abs_path);