mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-18 22:31:13 -06:00
Merge branch 'main' into enh-port-edit-gcode-dlg
This commit is contained in:
commit
a8c3377d9b
36 changed files with 156 additions and 304 deletions
|
@ -28,7 +28,7 @@
|
|||
|
||||
using namespace Slic3r;
|
||||
#include "ExPolygonsIndex.hpp"
|
||||
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <CGAL/Polygon_mesh_processing/corefinement.h>
|
||||
#include <CGAL/Exact_integer.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
|
|
@ -31,7 +31,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/nowide/fstream.hpp>
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
#include <boost/spirit/include/karma.hpp>
|
||||
|
@ -1290,9 +1289,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
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);
|
||||
load_string_file(model.get_backup_path() + "/origin.txt", m_origin_file);
|
||||
} catch (...) {}
|
||||
boost::filesystem::save_string_file(
|
||||
save_string_file(
|
||||
model.get_backup_path() + "/lock.txt",
|
||||
boost::lexical_cast<std::string>(get_current_pid()));
|
||||
}
|
||||
|
@ -1305,7 +1304,7 @@ 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);
|
||||
save_string_file(model.get_backup_path() + "/origin.txt", filename);
|
||||
}
|
||||
if (m_load_restore && !result) // not clear failed backup data for later analyze
|
||||
model.set_backup_path("detach");
|
||||
|
@ -5544,7 +5543,7 @@ 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);
|
||||
save_string_file(store_params.model->get_backup_path() + "/origin.txt", filename);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -8287,7 +8286,7 @@ bool has_restore_data(std::string & path, std::string& origin)
|
|||
}
|
||||
if (boost::filesystem::exists(path + "/lock.txt")) {
|
||||
std::string pid;
|
||||
boost::filesystem::load_string_file(path + "/lock.txt", pid);
|
||||
load_string_file(path + "/lock.txt", pid);
|
||||
try {
|
||||
if (get_process_name(boost::lexical_cast<int>(pid)) ==
|
||||
get_process_name(0)) {
|
||||
|
@ -8304,7 +8303,7 @@ bool has_restore_data(std::string & path, std::string& origin)
|
|||
return false;
|
||||
try {
|
||||
if (boost::filesystem::exists(path + "/origin.txt"))
|
||||
boost::filesystem::load_string_file(path + "/origin.txt", origin);
|
||||
load_string_file(path + "/origin.txt", origin);
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libslic3r/format.hpp"
|
||||
#undef PI
|
||||
|
||||
#include <boost/next_prior.hpp>
|
||||
// Include igl first. It defines "L" macro which then clashes with our localization
|
||||
#include <igl/copyleft/cgal/mesh_boolean.h>
|
||||
#undef L
|
||||
|
|
|
@ -38,7 +38,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/log/trivial.hpp>
|
||||
#include <boost/nowide/iostream.hpp>
|
||||
|
||||
|
@ -873,7 +872,7 @@ 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",
|
||||
save_string_file(backup_path + "/lock.txt",
|
||||
boost::lexical_cast<std::string>(get_current_pid()));
|
||||
}
|
||||
} catch (std::exception &ex) {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
///|/
|
||||
#include "Triangulation.hpp"
|
||||
#include "IntersectionPoints.hpp"
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
|
||||
|
|
|
@ -655,6 +655,9 @@ inline std::string filter_characters(const std::string& str, const std::string&
|
|||
|
||||
void copy_directory_recursively(const boost::filesystem::path &source, const boost::filesystem::path &target);
|
||||
|
||||
// Orca: Since 1.7.9 Boost deprecated save_string_file and load_string_file, copy and modified from boost 1.7.8
|
||||
void save_string_file(const boost::filesystem::path& p, const std::string& str);
|
||||
void load_string_file(const boost::filesystem::path& p, std::string& str);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
|
|
|
@ -1539,4 +1539,22 @@ void copy_directory_recursively(const boost::filesystem::path &source, const boo
|
|||
return;
|
||||
}
|
||||
|
||||
void save_string_file(const boost::filesystem::path& p, const std::string& str)
|
||||
{
|
||||
boost::nowide::ofstream file;
|
||||
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||
file.open(p.generic_string(), std::ios_base::binary);
|
||||
file.write(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
void load_string_file(const boost::filesystem::path& p, std::string& str)
|
||||
{
|
||||
boost::nowide::ifstream file;
|
||||
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||
file.open(p.generic_string(), std::ios_base::binary);
|
||||
std::size_t sz = static_cast<std::size_t>(boost::filesystem::file_size(p));
|
||||
str.resize(sz, '\0');
|
||||
file.read(&str[0], sz);
|
||||
}
|
||||
|
||||
}; // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue