Use Linux-style paths when saving custom bed texture and model files into config

This commit is contained in:
Enrico Turri 2019-11-12 11:59:33 +01:00
parent f7e27eb21d
commit cc919c68b8
2 changed files with 32 additions and 2 deletions

View file

@ -204,6 +204,7 @@ bool Bed3D::set_shape(const Pointfs& shape, const std::string& custom_texture, c
std::string cst_texture(custom_texture);
if (!cst_texture.empty())
{
std::replace(cst_texture.begin(), cst_texture.end(), '\\', '/');
if ((!boost::algorithm::iends_with(custom_texture, ".png") && !boost::algorithm::iends_with(custom_texture, ".svg")) || !boost::filesystem::exists(custom_texture))
cst_texture = "";
}
@ -212,6 +213,7 @@ bool Bed3D::set_shape(const Pointfs& shape, const std::string& custom_texture, c
std::string cst_model(custom_model);
if (!cst_model.empty())
{
std::replace(cst_model.begin(), cst_model.end(), '\\', '/');
if (!boost::algorithm::iends_with(custom_model, ".stl") || !boost::filesystem::exists(custom_model))
cst_model = "";
}