Material: Replace YAML::LoadFile() with YAML::Load()

YAML::LoadFile() cannot be used on Windows because it doesn't support UTF-16 to load a file from an arbitrary location

This fixes #17097
This commit is contained in:
wmayer
2024-11-08 23:23:35 +01:00
committed by Chris Hennes
parent 22519cc282
commit 9126e7e9c8

View File

@@ -27,7 +27,9 @@
#endif
#include <App/Application.h>
#include <Base/FileInfo.h>
#include <Base/Interpreter.h>
#include <Base/Stream.h>
#include "Model.h"
@@ -76,7 +78,9 @@ const QString ModelLoader::getUUIDFromPath(const QString& path)
}
try {
YAML::Node yamlroot = YAML::LoadFile(path.toStdString());
Base::FileInfo fi(path.toStdString());
Base::ifstream str(fi);
YAML::Node yamlroot = YAML::Load(str);
std::string base = "Model";
if (yamlroot["AppearanceModel"]) {
base = "AppearanceModel";
@@ -103,7 +107,9 @@ std::shared_ptr<ModelEntry> ModelLoader::getModelFromPath(std::shared_ptr<ModelL
std::string uuid;
std::string name;
try {
yamlroot = YAML::LoadFile(path.toStdString());
Base::FileInfo fi(path.toStdString());
Base::ifstream str(fi);
yamlroot = YAML::Load(str);
if (yamlroot["AppearanceModel"]) {
base = "AppearanceModel";
}