diff options
-rw-r--r-- | src/common/pkgmgr_interface.cc | 24 | ||||
-rw-r--r-- | src/common/pkgmgr_interface.h | 2 |
2 files changed, 4 insertions, 22 deletions
diff --git a/src/common/pkgmgr_interface.cc b/src/common/pkgmgr_interface.cc index 5464bae2..4d787ac5 100644 --- a/src/common/pkgmgr_interface.cc +++ b/src/common/pkgmgr_interface.cc @@ -9,7 +9,6 @@ #include <tzplatform_config.h> -#include <cstring> #include <memory> #include <string> #include <fstream> @@ -24,7 +23,6 @@ namespace bf = boost::filesystem; namespace { const char kDeltaFileExtension[] = ".delta"; -const char kLegacyContentPath[] = "/opt/usr/media"; const uid_t kGlobalUserUid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); } @@ -108,7 +106,7 @@ RequestType PkgMgrInterface::GetRequestType() const { switch (pkgmgr_installer_get_request_type(pi_)) { case PKGMGR_REQ_INSTALL : { auto request_info = GetRequestInfo(); - if (request_info.empty()) + if (!request_info) return RequestType::Unknown; std::string extension = bf::path(request_info).extension().string(); if (!is_app_installed_.get()) { @@ -179,24 +177,8 @@ uid_t PkgMgrInterface::GetUid() const { return pkgmgr_installer_get_uid(pi_); } -std::string PkgMgrInterface::GetRequestInfo() const { - std::string info; - const char* raw_info = pkgmgr_installer_get_request_info(pi_); - if (raw_info == nullptr) - return {}; - // to support legacy content directory path, - // if the requested path starts with "/opt/usr/media", return modified path. - // note that "/opt/usr/media" is a mount point for TZ_USER_CONTENT. - if (!strncmp(raw_info, kLegacyContentPath, strlen(kLegacyContentPath))) { - tzplatform_set_user(GetUid()); - const char* content_path = tzplatform_getenv(TZ_USER_CONTENT); - tzplatform_reset_user(); - info = std::string(content_path) + - std::string(raw_info + strlen(kLegacyContentPath)); - } else { - info = std::string(raw_info); - } - return info; +const char* PkgMgrInterface::GetRequestInfo() const { + return pkgmgr_installer_get_request_info(pi_); } boost::filesystem::path PkgMgrInterface::GetTepPath() const { diff --git a/src/common/pkgmgr_interface.h b/src/common/pkgmgr_interface.h index 86beb196..f903a8c8 100644 --- a/src/common/pkgmgr_interface.h +++ b/src/common/pkgmgr_interface.h @@ -82,7 +82,7 @@ class PkgMgrInterface { * * \return request info retrieved from pkgmgr_installer */ - std::string GetRequestInfo() const; + const char *GetRequestInfo() const; /** * Creates PkgMgrInterface |