Skip to content

Commit

Permalink
feat: Add better error messages for conversion fail and file-not-found
Browse files Browse the repository at this point in the history
  • Loading branch information
ENDERZOMBI102 committed Jan 20, 2024
1 parent 1231f86 commit 6844e09
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cli/action_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ bool ActionConvert::process_file(
}
// Add standard image data
else if (!add_image_data(srcFile, vtfFile.get(), procFormat, true)) {
std::cerr << "Could not add image data from file " << srcFile << "\n";
if (!std::filesystem::exists(srcFile)) {
std::cerr << "Could not open " << srcFile << ", file does not exist\n";
} else {
std::cerr << "Could not add image data from file " << srcFile << "\n";
}
return false;
}

Expand Down Expand Up @@ -583,7 +587,8 @@ bool ActionConvert::add_image_data_raw(
// This is done here because we don't actually know w/h until now
if (create) {
if (!file->Init(w, h, 1, 1, 1, format, vlTrue, m_mips)) {
std::cerr << "Could not create VTF.\n";
// +7 so we do not print `Error:\n`, which destroys the formatting
std::cerr << "Could not create VTF: " << LastError.Get() + 7 << "\n";
free(dest);
return false;
}
Expand Down

0 comments on commit 6844e09

Please sign in to comment.