From 46e78e3218cf1ac4337850fdb99ce7ea8ba17b64 Mon Sep 17 00:00:00 2001 From: David Carter Date: Wed, 29 May 2024 02:17:55 -0400 Subject: [PATCH] Materials: Correct issue with UTF8 path The YAML library is unable to open files with UTF8 paths --- src/Mod/Material/App/MaterialLoader.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Mod/Material/App/MaterialLoader.cpp b/src/Mod/Material/App/MaterialLoader.cpp index 7008555db0..9ee6f77353 100644 --- a/src/Mod/Material/App/MaterialLoader.cpp +++ b/src/Mod/Material/App/MaterialLoader.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include "Materials.h" @@ -405,9 +406,16 @@ MaterialLoader::getMaterialFromPath(const std::shared_ptr& libr return model; } + Base::FileInfo info(pathName); + Base::ifstream fin(info); + if (!fin) { + Base::Console().Error("YAML file open error: '%s'\n", pathName.c_str()); + return model; + } + YAML::Node yamlroot; try { - yamlroot = YAML::LoadFile(pathName); + yamlroot = YAML::Load(fin); model = getMaterialFromYAML(library, yamlroot, path); }