locations.push_back(res_icons_location);
for (auto& location : locations) {
- if (bf::exists(location)) {
+ if (bf::exists(location))
return location;
- }
}
+
return {};
}
const bf::path& common_icon_location, const bf::path& icon_text,
application_x* app, icon_x* icon) {
bf::path destination = common_icon_location / app->appid;
- if (!icon_text.extension().empty()) {
+ if (!icon_text.extension().empty())
destination += icon_text.extension();
- } else {
+ else
destination += ".png";
- }
- if (!common_installer::CopyFile(icon_text, destination)) {
+
+ if (!common_installer::CopyFile(icon_text, destination))
return Status::ICON_ERROR;
- }
+
free(const_cast<char*>(icon->text));
icon->text = strdup(destination.c_str());
+ if (!icon->text)
+ return Status::ICON_ERROR;
+
return Status::OK;
}
context_->is_readonly_package.get());
if (!source.empty()) {
LOG(DEBUG) << "Fix location of icon: " << source << " to: " << icon_text;
- if (!common_installer::CopyFile(source, icon_text)) {
+ if (!common_installer::CopyFile(source, icon_text))
return Status::ICON_ERROR;
- }
}
return Status::OK;
}
common_installer::Step::Status StepTpkPatchIcons::process() {
bf::path common_icon_location = context_->GetPkgPath() / "shared" / "res";
+
bs::error_code error;
bf::create_directories(common_icon_location, error);
+ if (error) {
+ LOG(ERROR) << "Failed to create directory :" << common_icon_location
+ << ", error :" << error.message();
+ return Status::ICON_ERROR;
+ }
+
for (application_x* app :
GListRange<application_x*>(context_->manifest_data.get()->application)) {
if (!IsTpkApp(app))
}
} else {
// look for icon in different location if it doesn't exist
- if (!bf::exists(icon->text)) {
+ if (!bf::exists(icon_text)) {
Status status = FixIconLocation(icon_text);
if (status != Status::OK)
return status;