#include "common/step/filesystem/step_remove_files.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/system/error_code.hpp>
-
#include <sys/types.h>
#include <tzplatform_config.h>
#include <algorithm>
+#include <filesystem>
#include <string>
#include <vector>
#include "common/utils/user_util.h"
#include "common/shared_dirs.h"
-namespace bs = boost::system;
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
const uid_t kGlobalUserUid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
const char kSubsesionDir[] = "subsession";
-bool SkipRWDirectories(const bf::path& path) {
+bool SkipRWDirectories(const fs::path& path) {
static const std::vector<std::string> dirs_to_ignore = {
{"cache"},
{"data"},
}
bool RemoveSignature(const std::string& pkgid, bool is_readonly) {
- bf::path signature_path = bf::path(is_readonly ?
+ fs::path signature_path = fs::path(is_readonly ?
tzplatform_getenv(TZ_SYS_RO_SHARE) : tzplatform_getenv(TZ_SYS_SHARE)) /
"signatures";
signature_path /= std::string(pkgid + ".txt");
// to remove the files
if (context_->GetPkgPath().empty())
LOG(ERROR) << "pkg_path attribute is empty";
- else if (!bf::exists(context_->GetPkgPath()))
+ else if (!fs::exists(context_->GetPkgPath()))
LOG(ERROR) << "pkg_path ("
<< context_->GetPkgPath()
<< ") path does not exist";
}
bool is_error = false;
- std::vector<bf::path> root_paths;
+ std::vector<fs::path> root_paths;
// Use RootAppPath + Pkgid because of ReadonlyUpdateUninstall
root_paths.push_back(context_->root_application_path.get());
for (auto& root_path : root_paths) {
if (is_keep_rwdata) {
bool ret;
- for (bf::directory_iterator itr(root_path / context_->pkgid.get());
- itr != bf::directory_iterator(); ++itr) {
- if (bf::is_directory(itr->status())) {
- if (SkipRWDirectories(itr->path().leaf())) {
+ for (fs::directory_iterator itr(root_path / context_->pkgid.get());
+ itr != fs::directory_iterator(); ++itr) {
+ if (fs::is_directory(itr->status())) {
+ if (SkipRWDirectories(itr->path().filename())) {
LOG(DEBUG) << "Skipping remove dir:" << itr->path().c_str();
continue;
}
// Remove package files at extended storage
if (context_->storage.get() == Storage::EXTENDED) {
- bf::path extended_path =
- bf::path(GetExtendedRootAppPath(context_->uid.get())) /
+ fs::path extended_path =
+ fs::path(GetExtendedRootAppPath(context_->uid.get())) /
context_->pkgid.get();
if (!RemoveAll(extended_path))
return Status::APP_DIR_ERROR;
for (auto& lw_user : GetLightUserList(context_->uid.get())) {
if (context_->storage.get() == Storage::EXTENDED) {
- bf::path extended_path =
- bf::path(GetExtendedRootAppPath(context_->uid.get())) /
+ fs::path extended_path =
+ fs::path(GetExtendedRootAppPath(context_->uid.get())) /
kSubsesionDir / lw_user / context_->pkgid.get();
if (!RemoveAll(extended_path))
return Status::APP_DIR_ERROR;