From 3ee1ec3df83291d7f8b81e8af94dd8e637b1aa1e Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Thu, 11 Jul 2019 21:51:33 +0200 Subject: CLI: Warn if --export-file is used with multiple input files --- src/inkscape-application.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/inkscape-application.cpp') diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp index 75a81a4f5..6b0178e74 100644 --- a/src/inkscape-application.cpp +++ b/src/inkscape-application.cpp @@ -957,6 +957,15 @@ ConcreteInkscapeApplication::on_open(const Gio::Application::type_vec_files& if(_pdf_page) INKSCAPE.set_pdf_page(_pdf_page); + if (files.size() > 1 && !_file_export.export_filename.empty()) { + std::cerr << "ConcreteInkscapeApplication::on_open: " + "Can't use '--export-file' with multiple input files " + "(output file would be overwritten for each input file). " + "Please use '--export-type' instead and rename manually." + << std::endl; + return; + } + for (auto file : files) { // Open file SPDocument *document = document_open (file); @@ -973,13 +982,21 @@ template<> void ConcreteInkscapeApplication::on_open(const Gio::Application::type_vec_files& files, const Glib::ustring& hint) { - std::cout << "on_open" << std::endl; on_startup2(); if(_pdf_poppler) INKSCAPE.set_pdf_poppler(_pdf_poppler); if(_pdf_page) INKSCAPE.set_pdf_page(_pdf_page); + if (files.size() > 1 && !_file_export.export_filename.empty()) { + std::cerr << "ConcreteInkscapeApplication::on_open: " + "Can't use '--export-file' with multiple input files " + "(output file would be overwritten for each input file). " + "Please use '--export-type' instead and rename manually." + << std::endl; + return; + } + for (auto file : files) { if (_with_gui) { // Create a window for each file. -- cgit v1.2.3