From df98a2279e538c34e69df8dda4a1958bcd474e26 Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Thu, 23 Feb 2023 09:30:08 +0100 Subject: [PATCH] now exporting files with extension appended user can now specify output filename without extension, because this is handled by qr internally now --- CMakeLists.txt | 2 +- main.cpp | 2 +- src/PNGRenderer.hpp | 2 +- src/SVGRenderer.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a9108c..091f0d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(EXE_NAME "qr_${CMAKE_PROJECT_VERSION}-${ARCH}") project( qr - VERSION 1.0.1 + VERSION 1.1.0 LANGUAGES CXX ) diff --git a/main.cpp b/main.cpp index 2114099..93a0848 100644 --- a/main.cpp +++ b/main.cpp @@ -20,7 +20,7 @@ Usage: -f --format output file format. can be one of "cli, png, svg" -h --help show this help -i --input take data from this argument instead of stdin - -o --output output file name + -o --output output file name without extension -s --size desired output file size in pixels -t --type output QR code type. can be one of "small, medium, large" diff --git a/src/PNGRenderer.hpp b/src/PNGRenderer.hpp index ddd8b54..a0de5d7 100644 --- a/src/PNGRenderer.hpp +++ b/src/PNGRenderer.hpp @@ -13,7 +13,7 @@ class PNGRenderer : public PixelRenderer { virtual void render(const std::string& filename) override { this->generateBuffer(); - stbi_write_png(filename.c_str(), targetSize, targetSize, 4, this->bitmap.data(), sizeof(Color) * targetSize); + stbi_write_png((filename + ".png").c_str(), targetSize, targetSize, 4, this->bitmap.data(), sizeof(Color) * targetSize); } }; diff --git a/src/SVGRenderer.hpp b/src/SVGRenderer.hpp index a7a564f..ded525b 100644 --- a/src/SVGRenderer.hpp +++ b/src/SVGRenderer.hpp @@ -41,7 +41,7 @@ namespace massivedynamic { file << "" << std::endl; std::ofstream outFile; - outFile.open(filename); + outFile.open(filename + ".svg"); outFile << file.str(); outFile.close(); }