const char kManifestFileName[] = "tizen-manifest.xml";
const char kSharedResDir[] = "shared/res";
-bool ExtractPackageArchive(const std::string& archive_path,
- const std::string& file, const bf::path& tmp_dir) {
- if (!ci::ExtractToTmpDir(archive_path.c_str(), tmp_dir, file.c_str())) {
+} // namespace
+
+bool TpkArchiveInfo::ExtractPackageArchive(const std::string& archive_path,
+ const std::string& file, const std::string& tmp_dir) {
+ if (!ci::ExtractToTmpDir(archive_path.c_str(), bf::path(tmp_dir),
+ file.c_str())) {
LOG(ERROR) << "Failed to extract";
return false;
}
return true;
}
-} // namespace
-
bool TpkArchiveInfo::GetPackageInfo(const tpk::parse::TPKConfigParser& parser) {
auto pkg_info =
std::static_pointer_cast<const tpk::parse::PackageInfo>(
if (!ci::CreateDir(tmp_dir))
return false;
LOG(DEBUG) << "Unpack at temporary dir: " << tmp_dir;
- if (!ExtractPackageArchive(path_, kManifestFileName, tmp_dir))
+ if (!ExtractPackageArchive(path_, kManifestFileName, tmp_dir.string()))
return false;
tpk::parse::TPKConfigParser parser;
free(locale);
if (!icon_.empty()) {
bf::path icon_path = bf::path(kSharedResDir) / icon_;
- if (!ExtractPackageArchive(path_, icon_path.string(), tmp_dir)) {
- ci::RemoveAll(tmp_dir);
+ if (!ExtractPackageArchive(path_, icon_path.string(), tmp_dir.string())) {
+ RemoveTmpDir(tmp_dir.string());
return false;
}
if (!ReadIcon(icon_path, tmp_dir)) {
LOG(WARNING) << "Failed to get icon info";
- ci::RemoveAll(tmp_dir);
+ RemoveTmpDir(tmp_dir.string());
return false;
}
}
- ci::RemoveAll(tmp_dir);
+ RemoveTmpDir(tmp_dir.string());
return true;
}
explicit TpkArchiveInfo(std::string path)
: common_installer::ArchiveInfo(path) { }
bool LoadArchiveInfo() override;
+ bool ExtractPackageArchive(const std::string& archive_path,
+ const std::string& file, const std::string& tmp_dir) override;
protected:
bool GetPackageInfo(const tpk::parse::TPKConfigParser& parser);