Dominique Leuenberger 2022-04-25 21:35:51 +00:00 committed by Git OBS Bridge
commit 51a3c98daf
2 changed files with 106 additions and 19 deletions

View File

@ -1,31 +1,112 @@
Index: PrusaSlicer-version_2.4.1/src/hints/HintsToPot.cpp From 408e56f0390f20aaf793e0aa0c70c4d9544401d4 Mon Sep 17 00:00:00 2001
=================================================================== From: Vojtech Bubnik <bubnikv@gmail.com>
--- PrusaSlicer-version_2.4.1.orig/src/hints/HintsToPot.cpp Date: Mon, 25 Apr 2022 08:33:48 +0200
+++ PrusaSlicer-version_2.4.1/src/hints/HintsToPot.cpp Subject: [PATCH] Fix of Boost 1.79 deprecated boost::filesystem::ofstream
@@ -1,4 +1,5 @@ #8238 Replacing boost::filesystem::fstream with boost::nowide::fstream
#include <iostream> variants with the unfortunate cost of string path conversion on Windows from
+#include <fstream> 16 bits to UTF8 and back to 16 bits.
#include <vector>
#include <string> Unfortunately we cannot use std::filesystem yet as it is missing
#include <boost/filesystem.hpp> on older MACs and because the interface is crooked minefield on Windows
@@ -9,7 +10,7 @@ see https://github.com/microsoft/STL/issues/909
---
src/hints/HintsToPot.cpp | 2 +-
src/libslic3r/Preset.cpp | 2 +-
src/slic3r/GUI/HintNotification.cpp | 8 +++++---
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/hints/HintsToPot.cpp b/src/hints/HintsToPot.cpp
index 7c8029cdeb..4791f0612f 100644
--- a/src/hints/HintsToPot.cpp
+++ b/src/hints/HintsToPot.cpp
@@ -9,7 +9,7 @@
bool write_to_pot(boost::filesystem::path path, const std::vector<std::pair<std::string, std::string>>& data) bool write_to_pot(boost::filesystem::path path, const std::vector<std::pair<std::string, std::string>>& data)
{ {
- boost::filesystem::ofstream file(std::move(path), std::ios_base::app); - boost::filesystem::ofstream file(std::move(path), std::ios_base::app);
+ std::ofstream file(std::move(path.string()), std::ios_base::app); + boost::nowide::ofstream file(path.string(), std::ios_base::app);
for (const auto& element : data) for (const auto& element : data)
{ {
//Example of .pot element //Example of .pot element
Index: PrusaSlicer-version_2.4.1/tests/fff_print/test_data.cpp diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp
=================================================================== index f3a1c15b3e..f171cb14dd 100644
--- PrusaSlicer-version_2.4.1.orig/tests/fff_print/test_data.cpp --- a/src/libslic3r/Preset.cpp
+++ PrusaSlicer-version_2.4.1/tests/fff_print/test_data.cpp +++ b/src/libslic3r/Preset.cpp
@@ -9,6 +9,7 @@ @@ -84,7 +84,7 @@ ConfigFileType guess_config_file_type(const ptree &tree)
VendorProfile VendorProfile::from_ini(const boost::filesystem::path &path, bool load_all)
{
ptree tree;
- boost::filesystem::ifstream ifs(path);
+ boost::nowide::ifstream ifs(path.string());
boost::property_tree::read_ini(ifs, tree);
return VendorProfile::from_ini(tree, path, load_all);
}
diff --git a/src/slic3r/GUI/HintNotification.cpp b/src/slic3r/GUI/HintNotification.cpp
index 93e0fb3259..820b74eedb 100644
--- a/src/slic3r/GUI/HintNotification.cpp
+++ b/src/slic3r/GUI/HintNotification.cpp
@@ -14,12 +14,14 @@
#include "libslic3r/Config.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <cstdlib> +#include <map>
+
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ini_parser.hpp>
-#include <map>
+
#include <cereal/archives/binary.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/vector.hpp>
@@ -65,7 +67,7 @@ inline void push_style_color(ImGuiCol idx, const ImVec4& col, bool fading_out, f
void write_used_binary(const std::vector<std::string>& ids)
{
- boost::filesystem::ofstream file((boost::filesystem::path(data_dir()) / "cache" / "hints.cereal"), std::ios::binary);
+ boost::nowide::ofstream file((boost::filesystem::path(data_dir()) / "cache" / "hints.cereal").string(), std::ios::binary);
cereal::BinaryOutputArchive archive(file);
HintsCerealData cd { ids };
try
@@ -84,7 +86,7 @@ void read_used_binary(std::vector<std::string>& ids)
BOOST_LOG_TRIVIAL(warning) << "Failed to load to hints.cereal. File does not exists. " << path.string();
return;
}
- boost::filesystem::ifstream file(path);
+ boost::nowide::ifstream file(path.string());
cereal::BinaryInputArchive archive(file);
HintsCerealData cd;
try
From 926ae0471800abd1e5335e251a5934570eb8f6ff Mon Sep 17 00:00:00 2001
From: Vojtech Bubnik <bubnikv@gmail.com>
Date: Mon, 25 Apr 2022 11:32:03 +0200
Subject: [PATCH] Follow-up to 408e56f0390f20aaf793e0aa0c70c4d9544401d4 Fixing
compilation of tests on latest GCC/boost
---
tests/fff_print/test_data.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/fff_print/test_data.cpp b/tests/fff_print/test_data.cpp
index 32e31c264c..f7077007db 100644
--- a/tests/fff_print/test_data.cpp
+++ b/tests/fff_print/test_data.cpp
@@ -11,6 +11,7 @@
#include <string> #include <string>
+#include <fstream>
#include <boost/nowide/cstdio.hpp> #include <boost/nowide/cstdio.hpp>
+#include <boost/nowide/fstream.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <libslic3r/ModelArrange.hpp>
@@ -286,7 +287,7 @@ std::string gcode(Print & print)
print.set_status_silent();
print.process();
print.export_gcode(temp.string(), nullptr, nullptr);
- std::ifstream t(temp.string());
+ boost::nowide::ifstream t(temp.string());
std::string str((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
boost::nowide::remove(temp.string().c_str());
return str;

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 25 11:27:58 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Refresh PrusaSlicer-boost1.79.patch with upstream's fix
* gh#prusa3d/PrusaSlicer#8238
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Apr 24 09:26:22 UTC 2022 - Ben Greiner <code@bnavigator.de> Sun Apr 24 09:26:22 UTC 2022 - Ben Greiner <code@bnavigator.de>