bambu-studio: 01.10.02.76 -> 02.02.00.85 (#427468)

This commit is contained in:
Gaétan Lepage
2025-08-29 16:17:26 +02:00
committed by GitHub
6 changed files with 13 additions and 450 deletions
@@ -1,275 +0,0 @@
From 0fada0c6fe84bed0b311c493aa3f91bf35428bc8 Mon Sep 17 00:00:00 2001
From: "Queen Vinyl Da.i'gyu-Kazotetsu" <vinyldarkscratch@gmail.com>
Date: Fri, 26 Apr 2024 09:56:49 -0700
Subject: [PATCH 1/4] Replace deprecated boost/filesystem/string_file.hpp
header
---
src/libslic3r/Format/bbs_3mf.cpp | 48 ++++++++++++++++++-------
src/libslic3r/Model.cpp | 6 ++--
src/slic3r/GUI/MediaPlayCtrl.cpp | 9 +++--
src/slic3r/Utils/PresetUpdater.cpp | 56 +++++++++++++++++++++++++-----
4 files changed, 91 insertions(+), 28 deletions(-)
diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp
index f13c62148..0e3b4e433 100644
--- a/src/libslic3r/Format/bbs_3mf.cpp
+++ b/src/libslic3r/Format/bbs_3mf.cpp
@@ -25,7 +25,6 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/string_file.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/nowide/cstdio.hpp>
@@ -1296,12 +1295,19 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
m_backup_path = filename.substr(0, filename.size() - 5);
model.set_backup_path(m_backup_path);
try {
- if (boost::filesystem::exists(model.get_backup_path() + "/origin.txt"))
- boost::filesystem::load_string_file(model.get_backup_path() + "/origin.txt", m_origin_file);
+ std::string filepath = model.get_backup_path() + "/origin.txt";
+ if (boost::filesystem::exists(filepath)) {
+ boost::filesystem::ifstream originfile(filepath);
+ m_origin_file.assign(
+ (std::istreambuf_iterator<char>(originfile)),
+ (std::istreambuf_iterator<char>())
+ );
+ originfile.close();
+ }
} catch (...) {}
- boost::filesystem::save_string_file(
- model.get_backup_path() + "/lock.txt",
- boost::lexical_cast<std::string>(get_current_pid()));
+ boost::filesystem::ofstream lockfile(model.get_backup_path() + "/lock.txt");
+ lockfile << boost::lexical_cast<std::string>(get_current_pid());
+ lockfile.close();
}
else {
m_backup_path = model.get_backup_path();
@@ -1312,7 +1318,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
file_version = *m_bambuslicer_generator_version;
// save for restore
if (result && m_load_aux && !m_load_restore) {
- boost::filesystem::save_string_file(model.get_backup_path() + "/origin.txt", filename);
+ boost::filesystem::ofstream originfile(model.get_backup_path() + "/origin.txt");
+ originfile << filename;
+ originfile.close();
}
if (m_load_restore && !result) // not clear failed backup data for later analyze
model.set_backup_path("detach");
@@ -5571,6 +5579,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
boost::system::error_code ec;
std::string filename = std::string(store_params.path);
boost::filesystem::remove(filename + ".tmp", ec);
+ boost::filesystem::ofstream outputfile;
bool result = _save_model_to_file(filename + ".tmp", *store_params.model, store_params.plate_data_list, store_params.project_presets, store_params.config,
store_params.thumbnail_data, store_params.no_light_thumbnail_data, store_params.top_thumbnail_data, store_params.pick_thumbnail_data,
@@ -5584,7 +5593,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
return false;
}
if (!(store_params.strategy & SaveStrategy::Silence))
- boost::filesystem::save_string_file(store_params.model->get_backup_path() + "/origin.txt", filename);
+ outputfile.open(store_params.model->get_backup_path() + "/origin.txt");
+ outputfile << filename;
+ outputfile.close();
}
return result;
}
@@ -8488,9 +8499,14 @@ bool has_restore_data(std::string & path, std::string& origin)
origin = "<lock>";
return false;
}
- if (boost::filesystem::exists(path + "/lock.txt")) {
- std::string pid;
- boost::filesystem::load_string_file(path + "/lock.txt", pid);
+ const std::string lockfile_path = path + "/lock.txt";
+ if (boost::filesystem::exists(lockfile_path)) {
+ boost::filesystem::ifstream lockfile(lockfile_path);
+ std::string pid(
+ (std::istreambuf_iterator<char>(lockfile)),
+ (std::istreambuf_iterator<char>())
+ );
+ lockfile.close();
try {
if (get_process_name(boost::lexical_cast<int>(pid)) ==
get_process_name(0)) {
@@ -8506,8 +8522,14 @@ bool has_restore_data(std::string & path, std::string& origin)
if (!boost::filesystem::exists(file3mf))
return false;
try {
- if (boost::filesystem::exists(path + "/origin.txt"))
- boost::filesystem::load_string_file(path + "/origin.txt", origin);
+ if (boost::filesystem::exists(path + "/origin.txt")) {
+ boost::filesystem::ifstream originfile(path + "/origin.txt");
+ origin.assign(
+ (std::istreambuf_iterator<char>(originfile)),
+ (std::istreambuf_iterator<char>())
+ );
+ originfile.close();
+ }
}
catch (...) {
}
diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp
index 82328083c..51da0fb8b 100644
--- a/src/libslic3r/Model.cpp
+++ b/src/libslic3r/Model.cpp
@@ -23,7 +23,6 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
-#include <boost/filesystem/string_file.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/iostream.hpp>
@@ -980,8 +979,9 @@ std::string Model::get_backup_path()
BOOST_LOG_TRIVIAL(info) << "create /Metadata in " << temp_path;
boost::filesystem::create_directories(backup_path + "/Metadata");
BOOST_LOG_TRIVIAL(info) << "create /lock.txt in " << temp_path;
- boost::filesystem::save_string_file(backup_path + "/lock.txt",
- boost::lexical_cast<std::string>(get_current_pid()));
+ boost::filesystem::ofstream lockfile(backup_path + "/lock.txt");
+ lockfile << boost::lexical_cast<std::string>(get_current_pid());
+ lockfile.close();
}
} catch (std::exception &ex) {
BOOST_LOG_TRIVIAL(error) << "Failed to create backup path" << temp_path << ": " << ex.what();
diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp
index 9af0cc116..45de6fe1a 100644
--- a/src/slic3r/GUI/MediaPlayCtrl.cpp
+++ b/src/slic3r/GUI/MediaPlayCtrl.cpp
@@ -8,7 +8,6 @@
#include "MsgDialog.hpp"
#include "DownloadProgressDialog.hpp"
-#include <boost/filesystem/string_file.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>
@@ -824,8 +823,12 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install)
file_url2.Replace("\\", "/");
file_url2 = wxURI(file_url2).BuildURI();
try {
- std::string configs;
- boost::filesystem::load_string_file(file_ff_cfg, configs);
+ boost::filesystem::ifstream configfile(file_ff_cfg);
+ std::string configs(
+ (std::istreambuf_iterator<char>(configfile)),
+ (std::istreambuf_iterator<char>())
+ );
+ configfile.close();
std::vector<std::string> configss;
boost::algorithm::split(configss, configs, boost::algorithm::is_any_of("\r\n"));
configss.erase(std::remove(configss.begin(), configss.end(), std::string()), configss.end());
diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp
index 268c2685a..eb92e052b 100644
--- a/src/slic3r/Utils/PresetUpdater.cpp
+++ b/src/slic3r/Utils/PresetUpdater.cpp
@@ -9,7 +9,6 @@
#include <boost/format.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
-#include <boost/filesystem/string_file.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp>
@@ -1042,10 +1041,24 @@ void PresetUpdater::priv::sync_tooltip(std::string http_url, std::string languag
std::string language_version = "00.00.00.00";
fs::path cache_root = fs::path(data_dir()) / "resources/tooltip";
try {
- auto vf = cache_root / "common" / "version";
- if (fs::exists(vf)) fs::load_string_file(vf, common_version);
+ fs::path vf = cache_root / "common" / "version";
+ if (fs::exists(vf)) {
+ boost::filesystem::ifstream versionfile(vf);
+ common_version.assign(
+ (std::istreambuf_iterator<char>(versionfile)),
+ (std::istreambuf_iterator<char>())
+ );
+ versionfile.close();
+ }
vf = cache_root / language / "version";
- if (fs::exists(vf)) fs::load_string_file(vf, language_version);
+ if (fs::exists(vf)) {
+ boost::filesystem::ifstream versionfile(vf);
+ language_version.assign(
+ (std::istreambuf_iterator<char>(versionfile)),
+ (std::istreambuf_iterator<char>())
+ );
+ versionfile.close();
+ }
} catch (...) {}
std::map<std::string, Resource> resources
{
@@ -1183,13 +1196,23 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
try {
if (fs::exists(config_folder / "version.txt")) {
- fs::load_string_file(config_folder / "version.txt", curr_version);
+ boost::filesystem::ifstream filedata(config_folder / "version.txt");
+ curr_version.assign(
+ (std::istreambuf_iterator<char>(filedata)),
+ (std::istreambuf_iterator<char>())
+ );
+ filedata.close();
boost::algorithm::trim(curr_version);
}
} catch (...) {}
try {
if (fs::exists(cache_folder / "version.txt")) {
- fs::load_string_file(cache_folder / "version.txt", cached_version);
+ boost::filesystem::ifstream filedata(cache_folder / "version.txt");
+ cached_version.assign(
+ (std::istreambuf_iterator<char>(filedata)),
+ (std::istreambuf_iterator<char>())
+ );
+ filedata.close();
boost::algorithm::trim(cached_version);
}
} catch (...) {}
@@ -1229,7 +1252,12 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
bool result = false;
try {
if (fs::exists(cache_folder / "version.txt")) {
- fs::load_string_file(cache_folder / "version.txt", cached_version);
+ boost::filesystem::ifstream filedata(cache_folder / "version.txt");
+ cached_version.assign(
+ (std::istreambuf_iterator<char>(filedata)),
+ (std::istreambuf_iterator<char>())
+ );
+ filedata.close();
boost::algorithm::trim(cached_version);
result = true;
}
@@ -1334,13 +1362,23 @@ Updates PresetUpdater::priv::get_printer_config_updates(bool update) const
std::string resc_version;
try {
if (fs::exists(resc_folder / "version.txt")) {
- fs::load_string_file(resc_folder / "version.txt", resc_version);
+ boost::filesystem::ifstream filedata(resc_folder / "version.txt");
+ resc_version.assign(
+ (std::istreambuf_iterator<char>(filedata)),
+ (std::istreambuf_iterator<char>())
+ );
+ filedata.close();
boost::algorithm::trim(resc_version);
}
} catch (...) {}
try {
if (fs::exists(config_folder / "version.txt")) {
- fs::load_string_file(config_folder / "version.txt", curr_version);
+ boost::filesystem::ifstream filedata(config_folder / "version.txt");
+ curr_version.assign(
+ (std::istreambuf_iterator<char>(filedata)),
+ (std::istreambuf_iterator<char>())
+ );
+ filedata.close();
boost::algorithm::trim(curr_version);
}
} catch (...) {}
--
2.47.0
@@ -1,84 +0,0 @@
From f2135e69ac314f7aded3c3c1fc6650370c71ffc4 Mon Sep 17 00:00:00 2001
From: "Queen Vinyl Da.i'gyu-Kazotetsu" <vinyldarkscratch@gmail.com>
Date: Fri, 26 Apr 2024 10:03:43 -0700
Subject: [PATCH 2/4] Replace deprecated Boost methods/options
---
src/libslic3r/PrintBase.cpp | 2 +-
src/libslic3r/utils.cpp | 2 +-
src/slic3r/GUI/Auxiliary.cpp | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp
index 00c1b01bd..6921edc58 100644
--- a/src/libslic3r/PrintBase.cpp
+++ b/src/libslic3r/PrintBase.cpp
@@ -80,7 +80,7 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
cfg.opt_string("input_filename_base") + default_ext :
this->placeholder_parser().process(format, 0, &cfg);
if (filename.extension().empty())
- filename = boost::filesystem::change_extension(filename, default_ext);
+ filename.replace_extension(default_ext);
return filename.string();
} catch (std::runtime_error &err) {
throw Slic3r::PlaceholderParserError(L("Failed processing of the filename_format template.") + "\n" + err.what());
diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp
index 226b01e7b..72157f4da 100644
--- a/src/libslic3r/utils.cpp
+++ b/src/libslic3r/utils.cpp
@@ -830,7 +830,7 @@ CopyFileResult copy_file_inner(const std::string& from, const std::string& to, s
// That may happen when copying on some exotic file system, for example Linux on Chrome.
copy_file_linux(source, target, ec);
#else // __linux__
- boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec);
+ boost::filesystem::copy_file(source, target, boost::filesystem::copy_options::overwrite_existing, ec);
#endif // __linux__
if (ec) {
error_message = ec.message();
diff --git a/src/slic3r/GUI/Auxiliary.cpp b/src/slic3r/GUI/Auxiliary.cpp
index 7ee2a4428..91cc01fb5 100644
--- a/src/slic3r/GUI/Auxiliary.cpp
+++ b/src/slic3r/GUI/Auxiliary.cpp
@@ -346,7 +346,7 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
}
auto existing = false;
- auto dir = m_file_path.branch_path();
+ auto dir = m_file_path.parent_path();
auto new_fullname = new_file_name + m_file_path.extension().string();
@@ -462,8 +462,8 @@ void AuFile::on_set_cover()
wxGetApp().plater()->model().model_info->cover_file = path.string();
//wxGetApp().plater()->model().model_info->cover_file = m_file_name.ToStdString();
- auto full_path = m_file_path.branch_path();
- auto full_root_path = full_path.branch_path();
+ auto full_path = m_file_path.parent_path();
+ auto full_root_path = full_path.parent_path();
auto full_root_path_str = encode_path(full_root_path.string().c_str());
auto dir = wxString::Format("%s/.thumbnails", full_root_path_str);
@@ -507,8 +507,8 @@ void AuFile::on_set_delete()
auto is_fine = fs::remove(bfs_path);
if (m_cover) {
- auto full_path = m_file_path.branch_path();
- auto full_root_path = full_path.branch_path();
+ auto full_path = m_file_path.parent_path();
+ auto full_root_path = full_path.parent_path();
auto full_root_path_str = encode_path(full_root_path.string().c_str());
auto dir = wxString::Format("%s/.thumbnails", full_root_path_str);
fs::path dir_path(dir.c_str());
@@ -949,7 +949,7 @@ void AuxiliaryPanel::on_import_file(wxCommandEvent &event)
boost::system::error_code ec;
- if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_option::overwrite_if_exists, ec)) continue;
+ if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec)) continue;
Slic3r::put_other_changes();
// add in file list
--
2.47.0
@@ -1,39 +0,0 @@
From 2e8c6d293d15345e7bfd37529557833fc010e064 Mon Sep 17 00:00:00 2001
From: "Queen Vinyl Da.i'gyu-Kazotetsu" <vinyldarkscratch@gmail.com>
Date: Mon, 29 Apr 2024 02:13:59 -0700
Subject: [PATCH 3/4] Fix additional Boost upgrade issues
---
src/slic3r/GUI/AuxiliaryDataViewModel.cpp | 2 +-
src/slic3r/GUI/MediaPlayCtrl.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/slic3r/GUI/AuxiliaryDataViewModel.cpp b/src/slic3r/GUI/AuxiliaryDataViewModel.cpp
index f68f73306..9bb8835bf 100644
--- a/src/slic3r/GUI/AuxiliaryDataViewModel.cpp
+++ b/src/slic3r/GUI/AuxiliaryDataViewModel.cpp
@@ -336,7 +336,7 @@ wxDataViewItemArray AuxiliaryModel::ImportFile(AuxiliaryModelNode* sel, wxArrayS
dir_path += "\\" + src_bfs_path.filename().generic_wstring();
boost::system::error_code ec;
- if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_option::overwrite_if_exists, ec))
+ if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec))
continue;
// Update model data
diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp
index 45de6fe1a..762088431 100644
--- a/src/slic3r/GUI/MediaPlayCtrl.cpp
+++ b/src/slic3r/GUI/MediaPlayCtrl.cpp
@@ -840,7 +840,7 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install)
auto file_dll = tools_dir + dll;
auto file_dll2 = plugins_dir + dll;
if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2))
- boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_option::overwrite_if_exists);
+ boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_options::overwrite_existing);
}
boost::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir),
boost::process::windows::create_no_window,
--
2.47.0
@@ -1,33 +0,0 @@
From 1ff7f81740f9df7889f21ee3f779d90246890e4f Mon Sep 17 00:00:00 2001
From: Emily <hello@emily.moe>
Date: Mon, 25 Nov 2024 17:44:31 +0000
Subject: [PATCH 4/4] Remove deprecated Boost filesystem header
---
src/slic3r/GUI/RemovableDriveManager.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp
index fcddcbd61..b4e895c78 100644
--- a/src/slic3r/GUI/RemovableDriveManager.cpp
+++ b/src/slic3r/GUI/RemovableDriveManager.cpp
@@ -22,7 +22,6 @@
#include <pwd.h>
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
-#include <boost/filesystem/convenience.hpp>
#include <boost/process.hpp>
#endif
@@ -202,7 +201,7 @@ namespace search_for_drives_internal
stat(path.c_str(), &buf);
uid_t uid = buf.st_uid;
if (getuid() == uid)
- out.emplace_back(DriveData{ boost::filesystem::basename(boost::filesystem::path(path)), path });
+ out.emplace_back(DriveData{ boost::filesystem::path(path).stem().string(), path });
}
}
}
--
2.47.0
+12 -18
View File
@@ -7,9 +7,9 @@
ninja,
pkg-config,
wrapGAppsHook3,
boost186,
boost183,
cereal,
cgal,
cgal_5,
curl,
dbus,
eigen,
@@ -35,7 +35,7 @@
pcre,
systemd,
tbb_2021,
webkitgtk_4_0,
webkitgtk_4_1,
wxGTK31,
xorg,
withSystemd ? stdenv.hostPlatform.isLinux,
@@ -56,13 +56,13 @@ let
in
stdenv.mkDerivation rec {
pname = "bambu-studio";
version = "01.10.02.76";
version = "02.02.00.85";
src = fetchFromGitHub {
owner = "bambulab";
repo = "BambuStudio";
rev = "v${version}";
hash = "sha256-LvAi3I5lnnumhOUagyej28uVy0Lgd3e19HNQXOUWSvQ=";
tag = "v${version}";
hash = "sha256-JzZELCiP3Mmp3TWELG7lw3YioHgnsKCVxYaj9FAZobc=";
};
nativeBuildInputs = [
@@ -74,9 +74,9 @@ stdenv.mkDerivation rec {
buildInputs = [
binutils
boost186
boost183
cereal
cgal
cgal_5
curl
dbus
eigen
@@ -102,10 +102,10 @@ stdenv.mkDerivation rec {
openvdb
pcre
tbb_2021
webkitgtk_4_0
webkitgtk_4_1
wxGTK'
xorg.libX11
opencv.cxxdev
opencv
]
++ lib.optionals withSystemd [ systemd ]
++ checkInputs;
@@ -117,12 +117,6 @@ stdenv.mkDerivation rec {
./patches/dont-link-opencv-world-bambu.patch
# Don't link osmesa
./patches/no-osmesa.patch
# Fix the build with newer Boost versions. All but one commit is
# from <https://github.com/bambulab/BambuStudio/pull/3968>.
./0001-Replace-deprecated-boost-filesystem-string_file.hpp-.patch
./0002-Replace-deprecated-Boost-methods-options.patch
./0003-Fix-additional-Boost-upgrade-issues.patch
./0004-Remove-deprecated-Boost-filesystem-header.patch
];
doCheck = true;
@@ -142,11 +136,11 @@ stdenv.mkDerivation rec {
# It seems to be a known issue for Eigen:
# http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
"-Wno-ignored-attributes"
"-I${opencv.out}/include/opencv4"
"-I${opencv}/include/opencv4"
];
# prusa-slicer uses dlopen on `libudev.so` at runtime
NIX_LDFLAGS = lib.optionalString withSystemd "-ludev";
NIX_LDFLAGS = lib.optionalString withSystemd "-ludev" + " -L${opencv}/lib -lopencv_imgcodecs";
# TODO: macOS
prePatch = ''
@@ -23,7 +23,7 @@ index 9c5cb96..e92a0e3 100644
+# We link against webkit2gtk symbols in src/slic3r/GUI/Widgets/WebView.cpp
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ target_link_libraries(libslic3r_gui "-lwebkit2gtk-4.0")
+ target_link_libraries(libslic3r_gui "-lwebkit2gtk-4.1")
+endif ()
+
# Link the resources dir to where Slic3r GUI expects it