mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 22:05:53 +08:00
Fix special character in file path of SVG.
Found by "Ondřej Stříteský"
This commit is contained in:
parent
86879c5d92
commit
a2139d4eb4
@ -6,6 +6,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <charconv> // to_chars
|
#include <charconv> // to_chars
|
||||||
|
|
||||||
|
#include <boost/nowide/iostream.hpp>
|
||||||
#include "ClipperUtils.hpp"
|
#include "ClipperUtils.hpp"
|
||||||
#include "Emboss.hpp" // heal for shape
|
#include "Emboss.hpp" // heal for shape
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ NSVGimage_ptr nsvgParseFromFile(const std::string &filename, const char *units,
|
|||||||
|
|
||||||
std::unique_ptr<std::string> read_from_disk(const std::string &path)
|
std::unique_ptr<std::string> read_from_disk(const std::string &path)
|
||||||
{
|
{
|
||||||
std::ifstream fs{path};
|
boost::nowide::ifstream fs{path};
|
||||||
if (!fs.is_open())
|
if (!fs.is_open())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
@ -2202,12 +2202,14 @@ EmbossShape select_shape(std::string_view filepath, double tesselation_tolerance
|
|||||||
shape.svg_file.path = filepath; // copy
|
shape.svg_file.path = filepath; // copy
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!boost::filesystem::exists(shape.svg_file.path)) {
|
|
||||||
|
boost::filesystem::path path(shape.svg_file.path);
|
||||||
|
if (!boost::filesystem::exists(path)) {
|
||||||
show_error(nullptr, GUI::format(_u8L("File does NOT exist (%1%)."), shape.svg_file.path));
|
show_error(nullptr, GUI::format(_u8L("File does NOT exist (%1%)."), shape.svg_file.path));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!boost::algorithm::iends_with(shape.svg_file.path, ".svg")){
|
if (!boost::algorithm::iends_with(shape.svg_file.path, ".svg")) {
|
||||||
show_error(nullptr, GUI::format(_u8L("Filename has to end with \".svg\" but you selected %1%"), shape.svg_file.path));
|
show_error(nullptr, GUI::format(_u8L("Filename has to end with \".svg\" but you selected %1%"), shape.svg_file.path));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1645,7 +1645,7 @@ private:
|
|||||||
namespace {
|
namespace {
|
||||||
bool emboss_svg(Plater& plater, const wxString &svg_file, const Vec2d& mouse_drop_position)
|
bool emboss_svg(Plater& plater, const wxString &svg_file, const Vec2d& mouse_drop_position)
|
||||||
{
|
{
|
||||||
std::string svg_file_str = svg_file.ToStdString();
|
std::string svg_file_str = into_u8(svg_file);
|
||||||
GLCanvas3D* canvas = plater.canvas3D();
|
GLCanvas3D* canvas = plater.canvas3D();
|
||||||
if (canvas == nullptr)
|
if (canvas == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user