diff --git a/Bin2CPP/Sources/Bin2CPP/main.cpp b/Bin2CPP/Sources/Bin2CPP/main.cpp index add0981..d948838 100644 --- a/Bin2CPP/Sources/Bin2CPP/main.cpp +++ b/Bin2CPP/Sources/Bin2CPP/main.cpp @@ -9,9 +9,9 @@ int main(int argc, char** argv) argv = app.ensure_utf8(argv); 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; - app.add_option("-o,--output", output, "The output file"); + app.add_option("-o,--output", output, "The output file")->required(); std::optional arrayType; app.add_option("--arrayType", arrayType, "The type of the array"); std::optional arrayInclude; @@ -46,19 +46,22 @@ int main(int argc, char** argv) generator.SetMapping(Bin2CPP::MappingKey::NAMESPACE, customNamespace.value()); } - if (generator.Generate()) + if (!generator.Generate()) { - std::ofstream out(output); - if (!out) - { - BIN2CPP_LOG_ERROR("Failed to open '{}'", output); - return 1; - } - - out << generator.Get(); - out.close(); + BIN2CPP_LOG_ERROR("Failed to generate '{}'", input); + return 1; } + std::ofstream out(output); + if (!out) + { + BIN2CPP_LOG_ERROR("Failed to open '{}'", output); + return 1; + } + + out << generator.Get(); + out.close(); + BIN2CPP_LOG_INFO("'{}' Generated !", output); return 0; diff --git a/Bin2CPP/Sources/Bin2CPPLib/Generator.cpp b/Bin2CPP/Sources/Bin2CPPLib/Generator.cpp index 547cef6..1b7e190 100644 --- a/Bin2CPP/Sources/Bin2CPPLib/Generator.cpp +++ b/Bin2CPP/Sources/Bin2CPPLib/Generator.cpp @@ -240,7 +240,7 @@ bool Generator::ComputeData(const std::span p_data) std::string& value = m_mappingTable[magic_enum::enum_index(MappingKey::DATA).value()]; value.clear(); - constexpr std::size_t bytesPerLine = 5; + constexpr std::size_t bytesPerLine = 16; constexpr std::string_view linePrefix = "\n "; for (std::size_t i = 0; i < p_data.size(); ++i)