Fix no error message on fail
Some checks failed
Bin2CPP / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Successful in 1m12s
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd (Unity Build: OFF) (push) Has been cancelled
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd_asan (Unity Build: OFF) (push) Has been cancelled
Bin2CPP / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bin2CPP / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd (Unity Build: OFF) (push) Has been cancelled
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd_asan (Unity Build: OFF) (push) Has been cancelled
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd_asan (Unity Build: ON) (push) Has been cancelled
Bin2CPP / Clang Format Checks (push) Has been cancelled
Bin2CPP / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Successful in 1m12s
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd (Unity Build: OFF) (push) Successful in 44s
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd (Unity Build: ON) (push) Successful in 44s
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd_asan (Unity Build: OFF) (push) Successful in 48s
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd_asan (Unity Build: ON) (push) Successful in 50s
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd (Unity Build: ON) (push) Has been cancelled
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd_asan (Unity Build: ON) (push) Has been cancelled
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd (Unity Build: ON) (push) Has been cancelled
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Has started running
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Has started running
Conan Packaging / Package Bin2CPP/1.0.0 (push) Has been cancelled

This commit is contained in:
2026-03-29 03:12:16 +02:00
committed by Romain BOULLARD
parent b769357bd0
commit f322ce3655
2 changed files with 16 additions and 13 deletions

View File

@@ -9,9 +9,9 @@ int main(int argc, char** argv)
argv = app.ensure_utf8(argv); argv = app.ensure_utf8(argv);
std::string input; std::string input;
app.add_option("-f,--input", input, "The input file"); app.add_option("-f,--input", input, "The input file")->required();
std::string output; std::string output;
app.add_option("-o,--output", output, "The output file"); app.add_option("-o,--output", output, "The output file")->required();
std::optional<std::string> arrayType; std::optional<std::string> arrayType;
app.add_option("--arrayType", arrayType, "The type of the array"); app.add_option("--arrayType", arrayType, "The type of the array");
std::optional<std::string> arrayInclude; std::optional<std::string> arrayInclude;
@@ -46,8 +46,12 @@ int main(int argc, char** argv)
generator.SetMapping(Bin2CPP::MappingKey::NAMESPACE, customNamespace.value()); generator.SetMapping(Bin2CPP::MappingKey::NAMESPACE, customNamespace.value());
} }
if (generator.Generate()) if (!generator.Generate())
{ {
BIN2CPP_LOG_ERROR("Failed to generate '{}'", input);
return 1;
}
std::ofstream out(output); std::ofstream out(output);
if (!out) if (!out)
{ {
@@ -57,7 +61,6 @@ int main(int argc, char** argv)
out << generator.Get(); out << generator.Get();
out.close(); out.close();
}
BIN2CPP_LOG_INFO("'{}' Generated !", output); BIN2CPP_LOG_INFO("'{}' Generated !", output);

View File

@@ -240,7 +240,7 @@ bool Generator::ComputeData(const std::span<std::byte> p_data)
std::string& value = m_mappingTable[magic_enum::enum_index(MappingKey::DATA).value()]; std::string& value = m_mappingTable[magic_enum::enum_index(MappingKey::DATA).value()];
value.clear(); value.clear();
constexpr std::size_t bytesPerLine = 5; constexpr std::size_t bytesPerLine = 16;
constexpr std::string_view linePrefix = "\n "; constexpr std::string_view linePrefix = "\n ";
for (std::size_t i = 0; i < p_data.size(); ++i) for (std::size_t i = 0; i < p_data.size(); ++i)