Separate app paths for global app 41/57641/2 submit/accepted/tizen_mobile/20160122.025614
authorJunghoon Park <jh9216.park@samsung.com>
Thu, 21 Jan 2016 08:32:06 +0000 (17:32 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Thu, 21 Jan 2016 08:35:51 +0000 (17:35 +0900)
 - There are two types of global apps. One is read only and the other is writable. Paths for those are different each other.

Change-Id: Ic6144a55333bd265c9f527da044d8a237f1c6c05
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
src/appcore.c

index 8c6c9cc..4de390e 100644 (file)
@@ -46,7 +46,8 @@
 
 #define PKGNAME_MAX 256
 #define PATH_APP_ROOT tzplatform_getenv(TZ_USER_APP)
-#define PATH_RO_APP_ROOT tzplatform_getenv(TZ_SYS_RO_APP)
+#define PATH_SYS_RO_APP_ROOT tzplatform_getenv(TZ_SYS_RO_APP)
+#define PATH_SYS_RW_APP_ROOT tzplatform_getenv(TZ_SYS_RW_APP)
 #define PATH_RES "/res"
 #define PATH_LOCALE "/locale"
 
@@ -162,9 +163,16 @@ static int __get_dir_name(char *dirname)
                        PATH_APP_ROOT, pkg_name);
        if (r < 0)
                return -1;
-       if (access(dirname, R_OK) == 0) return 0;
+       if (access(dirname, R_OK) == 0)
+               return 0;
+       r = snprintf(dirname, PATH_MAX, "%s/%s" PATH_RES PATH_LOCALE,
+                       PATH_SYS_RO_APP_ROOT, pkg_name);
+       if (r < 0)
+               return -1;
+       if (access(dirname, R_OK) == 0)
+               return 0;
        r = snprintf(dirname, PATH_MAX, "%s/%s" PATH_RES PATH_LOCALE,
-                       PATH_RO_APP_ROOT, pkg_name);
+                       PATH_SYS_RW_APP_ROOT, pkg_name);
        if (r < 0)
                return -1;