Materials: Correct issue with UTF8 path

The YAML library is unable to open files with UTF8 paths
This commit is contained in:
David Carter
2024-05-29 02:17:55 -04:00
committed by wwmayer
parent 9bf7e7bac5
commit 46e78e3218

View File

@@ -31,6 +31,7 @@
#include <App/Application.h>
#include <Base/Interpreter.h>
#include <Base/Stream.h>
#include <Gui/MetaTypes.h>
#include "Materials.h"
@@ -405,9 +406,16 @@ MaterialLoader::getMaterialFromPath(const std::shared_ptr<MaterialLibrary>& 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);
}