Fixed several locales issues on file import/export

This commit is contained in:
Lukas Matena 2021-05-24 12:20:55 +02:00
parent 4a7f078527
commit c05b8210f2
3 changed files with 11 additions and 1 deletions

View file

@ -30,6 +30,8 @@
#include "stl.h"
#include "libslic3r/LocalesUtils.hpp"
void stl_generate_shared_vertices(stl_file *stl, indexed_triangle_set &its)
{
// 3 indices to vertex per face
@ -127,6 +129,7 @@ void stl_generate_shared_vertices(stl_file *stl, indexed_triangle_set &its)
bool its_write_off(const indexed_triangle_set &its, const char *file)
{
Slic3r::CNumericLocalesSetter locales_setter;
/* Open the file */
FILE *fp = boost::nowide::fopen(file, "w");
if (fp == nullptr) {
@ -146,6 +149,7 @@ bool its_write_off(const indexed_triangle_set &its, const char *file)
bool its_write_vrml(const indexed_triangle_set &its, const char *file)
{
Slic3r::CNumericLocalesSetter locales_setter;
/* Open the file */
FILE *fp = boost::nowide::fopen(file, "w");
if (fp == nullptr) {
@ -188,7 +192,7 @@ bool its_write_vrml(const indexed_triangle_set &its, const char *file)
bool its_write_obj(const indexed_triangle_set &its, const char *file)
{
Slic3r::CNumericLocalesSetter locales_setter;
FILE *fp = boost::nowide::fopen(file, "w");
if (fp == nullptr) {
BOOST_LOG_TRIVIAL(error) << "stl_write_obj: Couldn't open " << file << " for writing";

View file

@ -32,6 +32,8 @@
#include "stl.h"
#include "libslic3r/LocalesUtils.hpp"
#ifndef SEEK_SET
#error "SEEK_SET not defined"
#endif
@ -232,6 +234,7 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first)
bool stl_open(stl_file *stl, const char *file)
{
Slic3r::CNumericLocalesSetter locales_setter;
stl->clear();
FILE *fp = stl_open_count_facets(stl, file);
if (fp == nullptr)

View file

@ -992,6 +992,9 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
// save materials file
boost::filesystem::path mat_filename(filename);
mat_filename.replace_extension("mtl");
CNumericLocalesSetter locales_setter;
FILE* fp = boost::nowide::fopen(mat_filename.string().c_str(), "w");
if (fp == nullptr) {
BOOST_LOG_TRIVIAL(error) << "GCodeViewer::export_toolpaths_to_obj: Couldn't open " << mat_filename.string().c_str() << " for writing";