bool Upgrade() override;
private:
- int UnzipFiles(const char* dest_path);
+ int UnzipFiles(const std::string& dest_path);
int UnzipXml(const std::string& pkgid);
int UnzipData(const std::string& pkgid, const std::string& dest);
int UnzipPkgFromZip(const std::string& pkgid);
return true;
}
-int RwUpgrader::UnzipFiles(const char* dest_path) {
+int RwUpgrader::UnzipFiles(const std::string& dest_path) {
const char* unzip_argv[] = { "/usr/bin/unzip", "-oXqq", kOptZipFile,
- dest_path, "-d", "/", nullptr };
- int ret = BackendInvoker::XSystem(unzip_argv);
-
- return ret;
+ dest_path.c_str(), "-d", "/", nullptr };
+ return BackendInvoker::XSystem(unzip_argv);
}
int RwUpgrader::UnzipXml(const std::string& pkgid) {
std::string path = "opt/share/packages/" + pkgid + ".xml";
- int ret = UnzipFiles(path.c_str());
-
- return ret;
+ return UnzipFiles(path);
}
int RwUpgrader::UnzipData(const std::string& pkgid,
const std::string& dest) {
std::string path = dest + pkgid + "/*";
- int ret = UnzipFiles(path.c_str());
- if (ret != 0)
- return -1;
-
- return 0;
+ return UnzipFiles(path);
}
int RwUpgrader::UnzipPkgFromZip(const std::string& pkgid) {