Add error log when using --rm-all-app-profile option (#493) accepted/tizen/8.0/unified/20231113.182916 accepted/tizen/unified/20231114.041324
author최종헌/MDE Lab(SR)/삼성전자 <j-h.choi@samsung.com>
Mon, 13 Nov 2023 03:55:40 +0000 (12:55 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 13 Nov 2023 03:55:40 +0000 (12:55 +0900)
NativeLauncher/tool/profile_common.cc

index 80ae73d..c06f5d0 100644 (file)
@@ -74,7 +74,6 @@ profile_error_e removeAppProfileData(const std::string& pkgId, void *user_data)
                std::string dataPath = *it + "/" + pkgId + "/data/";
                if (!dataPath.empty() && exist(dataPath)) {
                        std::string pDataFile = dataPath + PROFILE_BASENAME;
-
                        if (exist(pDataFile)) {
                                if (!removeFile(pDataFile)) {
                                        _SERR("Failed to remove profile data file (%s).", pDataFile.c_str());
@@ -122,6 +121,10 @@ void removeAllAppProfileData()
 {
        // To reduce repeated getUserIds calls, get uids here.
        std::vector<std::string> userAppRoots = getUserAppRoots();
+       if (userAppRoots.empty()) {
+               _SERR("Failed to get app root directories of users");
+               return;
+       }
        int ret = pkgmgrinfo_appinfo_get_installed_list(removeAppProfileListCb, &userAppRoots);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get installed list");