Fix Update fail when there is no pacakge root path 83/316883/2
authorIlho Kim <ilho159.kim@samsung.com>
Thu, 19 Dec 2024 04:46:05 +0000 (13:46 +0900)
committerilho kim <ilho159.kim@samsung.com>
Thu, 19 Dec 2024 07:47:48 +0000 (07:47 +0000)
Among the steps executed in Update, there are steps that presupporse
that the root path of the package exists
If the root path of the package doesn't exist and there is package
information in the database, the update type installation is performed
and the update will fail
In this case, Install type installation is performed instead of Update
type

Change-Id: I1f5dae8a29101728a546667baf329ef08c6292af
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/common/pkgmgr_interface.cc

index b7d3ccdfb3397806456fbf84437b470b9d5292bd..03324daa60906a991301b50ff429af4ea06c9f6c 100644 (file)
@@ -18,6 +18,7 @@
 #include "common/pkgmgr_registration.h"
 #include "common/utils/file_util.h"
 #include "common/utils/manifest_util.h"
+#include "common/utils/request.h"
 #include "common/utils/user_util.h"
 
 namespace fs = std::filesystem;
@@ -32,8 +33,8 @@ const uid_t kGlobalUserUid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
 bool CheckIfAppFilesExists(const std::string& pkgid,
                            uid_t uid,
                            bool is_readonly) {
-  return fs::exists(ci::GetManifestLocation(pkgid,
-              uid, is_readonly));
+  return fs::exists(ci::GetManifestLocation(pkgid, uid, is_readonly)) &&
+      fs::exists(fs::path(ci::GetRootAppPath(is_readonly, uid)) / pkgid);
 }
 
 bool IsDeltaPkg(const std::string& path) {