PKG_CHECK_MODULES(APP2SD_DEPS REQUIRED app2sd)
PKG_CHECK_MODULES(CAPI_SYSTEM_INFO_DEPS REQUIRED capi-system-info)
PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf vconf-internal-keys)
+PKG_CHECK_MODULES(STORAGE_DEPS REQUIRED storage)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem regex program_options)
FIND_PACKAGE(GTest REQUIRED)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(vconf-internal-keys)
+BuildRequires: pkgconfig(storage)
Requires: ca-certificates-tizen
Requires: libtzplatform-config
#include "common/paths.h"
+#include <manifest_parser/utils/logging.h>
+
#include <pwd.h>
#include <tzplatform_config.h>
+#include <storage-internal.h>
namespace bf = boost::filesystem;
const int32_t kPWBufSize = sysconf(_SC_GETPW_R_SIZE_MAX);
const char kImageDir[] = ".image";
const char kBckExtension[] = ".bck";
-const char kExternalStorageDirPrefix[] = "SDCardA1";
+
+std::string GetSDcardMountPath() {
+ char* sdpath = nullptr;
+ int storage_id = 0;
+ int ret;
+
+ ret = storage_get_primary_sdcard(&storage_id, &sdpath);
+ if (ret != STORAGE_ERROR_NONE) {
+ if (sdpath)
+ free(sdpath);
+ return {};
+ }
+
+ if (sdpath) {
+ std::string mount_path(sdpath);
+ free(sdpath);
+ return mount_path;
+ }
+
+ return {};
+}
boost::filesystem::path GetBackupPath(
const boost::filesystem::path& pkg_path) {
}
boost::filesystem::path GetExternalCardPath() {
- return bf::path(tzplatform_mkpath(TZ_SYS_MEDIA, kExternalStorageDirPrefix));
+ return bf::path(GetSDcardMountPath());
}
boost::filesystem::path GetExternalTepPath(RequestMode request_mode,
uid_t uid) {
- bf::path result = GetExternalCardPath() / "tep";
+ bf::path result;
+ bf::path ext_mount_path = GetExternalCardPath();
+ if (bf::is_empty(ext_mount_path))
+ return result;
+ result = ext_mount_path / "tep";
if (request_mode == RequestMode::USER)
result /= GetUserNameForUID(uid);
return result;