Fix special character in file path of SVG.

Found by "Ondřej Stříteský"
This commit is contained in:
Filip Sykala - NTB T15p 2023-10-18 11:49:21 +02:00
parent 86879c5d92
commit a2139d4eb4
3 changed files with 7 additions and 4 deletions

View File

@ -6,6 +6,7 @@
#include <array>
#include <charconv> // to_chars
#include <boost/nowide/iostream.hpp>
#include "ClipperUtils.hpp"
#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::ifstream fs{path};
boost::nowide::ifstream fs{path};
if (!fs.is_open())
return nullptr;
std::stringstream ss;

View File

@ -2202,7 +2202,9 @@ EmbossShape select_shape(std::string_view filepath, double tesselation_tolerance
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));
return {};
}

View File

@ -1645,7 +1645,7 @@ private:
namespace {
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();
if (canvas == nullptr)
return false;