Skip to content

Commit

Permalink
Print error when unzipping fails to save a file (#235)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <louise@openrobotics.org>
  • Loading branch information
chapulina authored Mar 3, 2022
1 parent ae90993 commit add1647
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Zip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ bool Zip::Extract(const std::string &_src,
<< "Do you have the right permissions?" << std::endl;
return false;
}
continue;
}

// Create and write the files.
Expand All @@ -168,9 +169,17 @@ bool Zip::Extract(const std::string &_src,
if (len < 0)
ignerr << "Error reading " << sb.name << std::endl;
else
{
file.write(buf, len);

igndbg << "Created file [" << dst << "]" << std::endl;
if (file.fail())
{
ignerr << "Failed to write file [" << dst << "]" << std::endl;
}
else
{
igndbg << "Created file [" << dst << "]" << std::endl;
}
}

delete[] buf;
file.close();
Expand Down

0 comments on commit add1647

Please sign in to comment.