Skip to content

Commit

Permalink
Add graphics files to TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
artemis-beta committed Jan 19, 2022
1 parent 39775eb commit c12698b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/ros_packager.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Packager {
*
* @param doc_path full path to the documentation file
* *************************************************************************/
void addGraphicsFile(const QString& graphic_path) {graphics_files_.push_back(graphic_path);}
void addGraphicsFile(const QString& graphic_path) {graphic_files_.push_back(graphic_path);}

/*! *************************************************************************
* @brief add a contributor to the package, this is an additional author.
Expand Down
7 changes: 7 additions & 0 deletions src/ros_packager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ QString ROSPkg::Packager::createPackage() {
);
}

for(const QString& graphic_file : graphic_files_) {
QFile(graphic_file).copy(
out_dir_+
QDir::separator() + "Graphics" + QDir::separator() + QFileInfo(graphic_file).fileName()
);
}

const QString zip_file_ = out_dir_ + ".zip";

elz::zipFolder(out_dir_.toStdString(), zip_file_.toStdString());
Expand Down
13 changes: 13 additions & 0 deletions src/ros_system.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ void ROSPkg::System::unzipFile(const QString& file_name, const QString& author,
files_list_["toml"].push_back(new_toml_);

}

else if(files_list_["toml"].size() > 1) {
QMessageBox::critical(
parent_,
Expand Down Expand Up @@ -441,6 +442,18 @@ void ROSPkg::System::uninstall(const QString& sha) {
QFile(data_dir_ + "Sessions" + QDir::separator() + QString::fromStdString(ssn_file.string())).remove();
}

for(const std::filesystem::path& img_file: meta_data_.img_files()){
info_text_ += "\n\nRemoved '" + data_dir_ + "Images" + QDir::separator() + QString::fromStdString(img_file.string()) + "'";

QFile(data_dir_ + "Images" + QDir::separator() + QString::fromStdString(img_file.string())).remove();
}

for(const std::filesystem::path& graphic_file: meta_data_.graphic_files()){
info_text_ += "\n\nRemoved '" + data_dir_ + "Graphics" + QDir::separator() + QString::fromStdString(graphic_file.string()) + "'";

QFile(data_dir_ + "Graphics" + QDir::separator() + QString::fromStdString(graphic_file.string())).remove();
}

if(QDir doc_dir_(doc_dir_path_); doc_dir_.exists()){
info_text_ += "\n\nRemoved '" + doc_dir_path_;
doc_dir_.removeRecursively();
Expand Down

0 comments on commit c12698b

Please sign in to comment.