Revert "fix getting external path" 04/100004/2 accepted/tizen/3.0/common/20161128.091356 accepted/tizen/3.0/ivi/20161128.083024 accepted/tizen/3.0/mobile/20161128.082819 accepted/tizen/3.0/tv/20161128.082854 accepted/tizen/3.0/wearable/20161128.082943 submit/tizen_3.0/20161125.015709
authorjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 24 Nov 2016 16:55:05 +0000 (08:55 -0800)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 24 Nov 2016 16:56:14 +0000 (08:56 -0800)
This reverts commit c45238d8876e18e7259512ae80ed252670a2dea5.

Change-Id: Icd5cf55f1885f2d73e146e8fe0f2f22009af3ba6

CMakeLists.txt
include/aul.h
packaging/aul.spec
src/aul_path.c

index 964b525..d3d7a3f 100644 (file)
@@ -14,7 +14,7 @@ ENDIF (with_x11)
 
 # Set required packages
 INCLUDE(FindPkgConfig)
-SET(AUL-1_LIB_PKG_CHECK_MODULES dlog bundle xdgmime libtzplatform-config pkgmgr-info capi-system-info vconf sqlite3 iniparser gio-2.0 glib-2.0 libxml-2.0 ttrace storage)
+SET(AUL-1_LIB_PKG_CHECK_MODULES dlog bundle xdgmime libtzplatform-config pkgmgr-info capi-system-info vconf sqlite3 iniparser gio-2.0 glib-2.0 libxml-2.0 ttrace)
 IF (with_wayland)
        pkg_check_modules(libpkgs REQUIRED ${AUL-1_LIB_PKG_CHECK_MODULES} wayland-client tizen-extension-client ecore-wayland wayland-tbm-client tizen-remote-surface-client ecore)
 ENDIF (with_wayland)
index 394e6d4..8fda7ac 100644 (file)
@@ -31,7 +31,6 @@ extern "C" {
  * @brief Return values in AUL.
  */
 typedef enum _aul_return_val {
-       AUL_R_ENOENT = -15,             /**< App directory entry error */
        AUL_R_EREJECTED = -14,          /**< App disable for mode */
        AUL_R_ENOAPP = -13,             /**< Failed to find app ID or pkg ID */
        AUL_R_EHIDDENFORGUEST = -11,    /**< App hidden for guest mode */
index 6bb5a06..58b547a 100644 (file)
@@ -30,7 +30,6 @@ BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(iniparser)
 BuildRequires:  pkgconfig(sqlite3)
-BuildRequires:  pkgconfig(storage)
 BuildRequires:  pkgconfig(ttrace)
 %if %{with wayland}
 BuildRequires:  pkgconfig(ecore)
index 5afcc98..9f629a8 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <tzplatform_config.h>
 #include <pkgmgr-info.h>
-#include <storage-internal.h>
 
 #include "aul_api.h"
 #include "aul_util.h"
 
 #define ROOT_UID 0
 #define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
-#define DEFAULT_EXTERNAL_STORAGE "/opt/storage/sdcard"
+#define _EXTERNAL_APP_SPECIFIC_PATH(uid) ({ \
+       tzplatform_set_user(uid); \
+       const char *path = tzplatform_mkpath3(TZ_SYS_MEDIA, \
+               "SDCardA1/apps", tzplatform_getenv(TZ_USER_NAME)); \
+       tzplatform_reset_user(); \
+       path; })
+#define _APP_SPECIFIC_PATH tzplatform_getenv(TZ_USER_APP)
 
 static const char _DATA_DIR[] = "data/";
 static const char _CACHE_DIR[] = "cache/";
@@ -44,8 +49,6 @@ static const char _SHARED_DATA_DIR[] = "shared/data/";
 static const char _SHARED_TRUSTED_DIR[] = "shared/trusted/";
 static const char _SHARED_RESOURCE_DIR[] = "shared/res/";
 
-static char ext_specific_path[PATH_MAX];
-
 static const char * __get_specific_path(const char *pkgid, uid_t uid)
 {
        const char * path;
@@ -94,56 +97,25 @@ static int __get_pkgid(char *pkgid, int len, const char *appid, uid_t uid)
        return AUL_R_OK;
 }
 
-/* return value should be freed after use. */
-static char *__get_sdcard_path(void)
-{
-       char *sdpath = NULL;
-       char *result_path = NULL;
-       int storage_id = 0;
-       int ret;
-
-       ret = storage_get_primary_sdcard(&storage_id, &sdpath);
-       if (ret != STORAGE_ERROR_NONE)
-               _W("failed to get primary sdcard (%d)", ret);
-
-       if (sdpath)
-               result_path = sdpath;
-       else
-               result_path = strdup(DEFAULT_EXTERNAL_STORAGE);
-
-       return result_path;
-}
-
 static int __get_external_path(char **path, const char *appid,
                const char *dir_name, uid_t uid)
 {
        char buf[PATH_MAX];
        char pkgid[NAME_MAX];
-       char *ext_path;
        int ret;
 
        ret = __get_pkgid(pkgid, sizeof(pkgid), appid, uid);
        if (ret != AUL_R_OK)
                return ret;
 
-       assert(path);
+       snprintf(buf, sizeof(buf), "%s/%s/%s",
+               _EXTERNAL_APP_SPECIFIC_PATH(uid),
+                pkgid, dir_name ? dir_name : "");
 
-       *path = NULL;
-       ext_path = __get_sdcard_path();
-       if (ext_path) {
-               tzplatform_set_user(uid);
-               snprintf(buf, sizeof(buf), "%s/apps/%s/%s/%s",
-                       ext_path, tzplatform_getenv(TZ_USER_NAME),
-                       pkgid, dir_name ? dir_name : "");
-               tzplatform_reset_user();
-               free(ext_path);
-               ext_path = NULL;
-
-               *path = strdup(buf);
-       }
-       ret = AUL_R_OK;
+       assert(path);
+       *path = strdup(buf);
 
-       return ret;
+       return AUL_R_OK;
 }
 
 static int __get_path(char **path, const char *appid, const char *dir_name,
@@ -343,22 +315,7 @@ API const char *aul_get_app_specific_path(void)
 
 API const char *aul_get_app_external_specific_path(void)
 {
-       char *ext_path;
-       char *result_path = NULL;
-
-       ext_path = __get_sdcard_path();
-       if (ext_path) {
-               tzplatform_set_user(getuid());
-               snprintf(ext_specific_path, sizeof(ext_specific_path),
-                       "%s/apps/%s", ext_path,
-                       tzplatform_getenv(TZ_USER_NAME));
-               tzplatform_reset_user();
-               result_path = ext_specific_path;
-               free(ext_path);
-               ext_path = NULL;
-       }
-
-       return result_path;
+       return _EXTERNAL_APP_SPECIFIC_PATH(getuid());
 }
 
 API int aul_get_app_shared_data_path_by_appid(const char *appid, char **path)