bf::path config_path = widget_root_path / "config.xml";
ASSERT_TRUE(bf::exists(widget_root_path));
ASSERT_TRUE(bf::exists(config_path));
+
+ bf::path private_tmp_path = package_path / "tmp";
+ bf::path cache_path = package_path / "cache";
+ ASSERT_TRUE(bf::exists(private_tmp_path));
+ ASSERT_TRUE(bf::exists(cache_path));
}
// backups should not exist
const char kSharedDataLocation[] = "shared/data";
const char kSharedTrustedLocation[] = "shared/trusted";
const char kResWgtSubPath[] = "res/wgt";
+const char kTemporaryData[] = "tmp";
+const char kCacheDir[] = "cache";
} // namespace
namespace filesystem {
common_installer::Step::Status StepWgtCopyStorageDirectories::process() {
+ Status status = CreatePrivateTmpDir();
+ if (status != Status::OK)
+ return status;
+ status = CreateCacheDir();
+ if (status != Status::OK)
+ return status;
+
int version = context_->manifest_data.get()->api_version[0] - '0';
if (version < 3) {
LOG(DEBUG) << "Shared directory coping for tizen 2.x";
}
LOG(DEBUG) << "Shared directory coping for tizen 3.x";
- Status status = CopySharedDirectory();
+ status = CopySharedDirectory();
if (status != Status::OK)
return status;
return Status::OK;
}
+common_installer::Step::Status
+StepWgtCopyStorageDirectories::CreatePrivateTmpDir() {
+ bs::error_code error_code;
+ bf::path tmp_path = context_->pkg_path.get() / kTemporaryData;
+ bf::create_directory(tmp_path, error_code);
+ if (error_code) {
+ LOG(ERROR) << "Failed to create private temporary directory for package";
+ return Status::ERROR;
+ }
+ return Status::OK;
+}
+
+common_installer::Step::Status
+StepWgtCopyStorageDirectories::CreateCacheDir() {
+ bs::error_code error_code;
+ bf::path cache_path = context_->pkg_path.get() / kCacheDir;
+ bf::create_directory(cache_path, error_code);
+ if (error_code) {
+ LOG(ERROR) << "Failed to create cache directory for package";
+ return Status::ERROR;
+ }
+ return Status::OK;
+}
+
} // namespace filesystem
} // namespace wgt
const char kSharedLocation[] = "shared";
const char kResWgtSubPath[] = "res/wgt";
+const char kTemporaryData[] = "tmp";
+const char kCacheDir[] = "cache";
} // namespace
if (!SubShareDir())
return Status::ERROR;
+ if (!CreatePrivateTmpDir())
+ return Status::ERROR;
+
+ if (!CreateCacheDir())
+ return Status::ERROR;
+
return Status::OK;
}
return true;
}
+bool StepWgtCreateStorageDirectories::CreatePrivateTmpDir() {
+ bs::error_code error_code;
+ bf::path tmp_path = context_->pkg_path.get() / kTemporaryData;
+ bf::create_directory(tmp_path, error_code);
+ if (error_code) {
+ LOG(ERROR) << "Failed to create private temporary directory for package";
+ return false;
+ }
+ return true;
+}
+
+bool StepWgtCreateStorageDirectories::CreateCacheDir() {
+ bs::error_code error_code;
+ bf::path cache_path = context_->pkg_path.get() / kCacheDir;
+ bf::create_directory(cache_path, error_code);
+ if (error_code) {
+ LOG(ERROR) << "Failed to create cache directory for package";
+ return false;
+ }
+ return true;
+}
+
} // namespace filesystem
} // namespace wgt