mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-27 09:20:49 +00:00
IssueNo: #I5261G:fix clean cache bug
Description:fix clean cache bug Sig:SIG_ApplicaitonFramework Feature or Bugfix:BugFix Binary Source:No Signed-off-by: wangtiantian <wangtiantian19@huawei.com>
This commit is contained in:
parent
a8b012dd37
commit
1cc54126bc
@ -118,7 +118,7 @@ public:
|
||||
* @brief Get all cache file path.
|
||||
* @param dir Indicates the data dir.
|
||||
* @param cachesPath Indicates the cache file path.
|
||||
* @return Returns ERR_OK if get cache file path successfully; returns error code otherwise.
|
||||
* @return Returns ERR_OK if get cache file path successfully; returns error code otherwise.
|
||||
*/
|
||||
ErrCode GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath);
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
* @brief Get all cache file path.
|
||||
* @param dir Indicates the data dir.
|
||||
* @param cachesPath Indicates the cache file path.
|
||||
* @return Returns ERR_OK if set apl successfully; returns error code otherwise.
|
||||
* @return Returns ERR_OK if get cache file path successfully; returns error code otherwise.
|
||||
*/
|
||||
virtual ErrCode GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath) = 0;
|
||||
protected:
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
* @brief Get all cache file path.
|
||||
* @param dir Indicates the data dir.
|
||||
* @param cachesPath Indicates the cache file path.
|
||||
* @return Returns ERR_OK if set apl successfully; returns error code otherwise.
|
||||
* @return Returns ERR_OK if get cache file path successfully; returns error code otherwise.
|
||||
*/
|
||||
virtual ErrCode GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath) override;
|
||||
|
||||
|
@ -532,19 +532,17 @@ void BundleMgrHostImpl::CleanBundleCacheTask(const std::string &bundleName,
|
||||
}
|
||||
auto cleanCache = [rootDir, cleanCacheCallback]() {
|
||||
std::vector<std::string> caches;
|
||||
bool result = false;
|
||||
for (const auto &st : rootDir) {
|
||||
std::vector<std::string> cache;
|
||||
result = InstalldClient::GetInstance()->GetBundleCachePath(st, cache);
|
||||
if (result) {
|
||||
break;
|
||||
if (InstalldClient::GetInstance()->GetBundleCachePath(st, cache) != ERR_OK) {
|
||||
APP_LOGE("GetBundleCachePath failed, path: %{public}s", st.c_str());
|
||||
}
|
||||
for (const auto &item : cache) {
|
||||
caches.emplace_back(item);
|
||||
}
|
||||
}
|
||||
bool error = false;
|
||||
if (result) {
|
||||
if (!caches.empty()) {
|
||||
for (const auto& cache : caches) {
|
||||
error = InstalldClient::GetInstance()->CleanBundleDataDir(cache);
|
||||
if (error) {
|
||||
|
@ -127,7 +127,7 @@ ErrCode InstalldClient::SetDirApl(const std::string &dir, const std::string &bun
|
||||
return CallService(&IInstalld::SetDirApl, dir, bundleName, apl);
|
||||
}
|
||||
|
||||
ErrCode GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath)
|
||||
ErrCode InstalldClient::GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath)
|
||||
{
|
||||
if (dir.empty()) {
|
||||
APP_LOGE("params are invalid");
|
||||
|
Loading…
Reference in New Issue
Block a user