From c55173eba4dfff2ed906c4dc5fcfa191899060e3 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 12 Feb 2020 15:39:04 +0100 Subject: [PATCH] Follow-up of 00ecafe3d57955bf4bcb70ba6f8d35faf90b54df -> Fix of #3650 moved into 'SLAPrint::output_filename()' as the previous fix was breaking the export from GUI --- src/libslic3r/PrintBase.cpp | 2 +- src/libslic3r/SLAPrint.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp index 812e060c6d..81affe04d4 100644 --- a/src/libslic3r/PrintBase.cpp +++ b/src/libslic3r/PrintBase.cpp @@ -64,7 +64,7 @@ std::string PrintBase::output_filename(const std::string &format, const std::str boost::filesystem::path filename = format.empty() ? cfg.opt_string("input_filename_base") + default_ext : this->placeholder_parser().process(format, 0, &cfg); - if (filename.extension().string() != default_ext) + if (filename.extension().empty()) filename = boost::filesystem::change_extension(filename, default_ext); return filename.string(); } catch (std::runtime_error &err) { diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 06c4f687b9..ebe7b74027 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -597,7 +597,9 @@ void SLAPrint::finalize() std::string SLAPrint::output_filename(const std::string &filename_base) const { DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders(); - return this->PrintBase::output_filename(m_print_config.output_filename_format.value, ".sl1", filename_base, &config); + // we need to remove the extension from the format string or the following call to PrintBase::output_filename() won't be able to change it to ".sl1" + std::string format = boost::filesystem::path(m_print_config.output_filename_format.value).replace_extension("").string(); + return this->PrintBase::output_filename(format, ".sl1", filename_base, &config); } std::string SLAPrint::validate() const