if (!bf::exists(context_->pkg_path.get() / entry))
return Status::OK;
if (!ci::MoveDir(context_->pkg_path.get() / entry, backup_path,
- ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) {
- LOG(ERROR) << "Failed to backup file";
- return Status::APP_DIR_ERROR;
+ ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) {
+ LOG(ERROR) << "Failed to backup file";
+ return Status::APP_DIR_ERROR;
}
backupPath_ = backup_path;
bool DeleteUser(const char *user_name, bool rem_home_dir) {
bool rval = FALSE;
GumUser* guser = gum_user_get_by_name_sync(user_name, FALSE);
- if(guser)
+ if (guser)
rval = gum_user_delete_sync(guser, rem_home_dir);
return rval;
}
-}
-
+} // namespace
bool TouchFile(const bf::path& path) {
FILE* f = fopen(path.c_str(), "w+");
// User do not exist
return true;
DeleteUser(user_name, true);
- if (boost::optional<uid_t> uid = ci::GetUidByUserName(user_name));
- else {
+ if (boost::optional<uid_t> uid = ci::GetUidByUserName(user_name)) {
+ LOG(ERROR) << "Deleting test user failed";
+ return false;
+ } else {
std::cout << "User deleted properly: user_name=" << user_name
<< " uid=" << test_uid << std::endl;
return true;
}
- LOG(ERROR) << "Deleting test user failed";
- return false;
}
void RemoveAllRecoveryFiles() {
if (bf::is_symlink(symlink_status(iter->path())))
continue;
bool is_rw_dir = false;
- for(const auto rw_dir : rwDirectories) {
+ for (const auto rw_dir : rwDirectories) {
bf::path rw_dir_path = rw_dir;
bf::path relative_path = ci::MakeRelativePath(iter->path(), package_path);
is_rw_dir |= (relative_path == rw_dir_path);
UninstallAllAppsInDirectory(apps_rw, false);
}
-int GetAppInstalledTime(const char *appid, uid_t uid)
-{
- int ret = 0;
- int installed_time = 0;
- pkgmgrinfo_appinfo_h handle = NULL;
- ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return installed_time;
+int GetAppInstalledTime(const char *appid, uid_t uid) {
+ int ret = 0;
+ int installed_time = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return installed_time;
}