diff --git a/openVulkanoCpp/Base/EngineConfiguration.cpp b/openVulkanoCpp/Base/EngineConfiguration.cpp index 169907f..6045606 100644 --- a/openVulkanoCpp/Base/EngineConfiguration.cpp +++ b/openVulkanoCpp/Base/EngineConfiguration.cpp @@ -11,6 +11,7 @@ #include "EngineConfiguration.hpp" #include "IO/AppFolders.hpp" +#include "Utils.hpp" namespace OpenVulkano { @@ -23,20 +24,12 @@ namespace OpenVulkano EngineConfiguration::EngineConfiguration() { - const std::string filePath = AppFolders::GetAppConfigHomeDir().string() + "/EngineConfig.yml"; - std::ifstream file(filePath); - if (!file.is_open()) - { + const std::string filePath = (AppFolders::GetAppConfigHomeDir() / "EngineConfig.yml").string(); + Array fileContents = Utils::ReadFile(filePath, true); + if(fileContents.Size() == 0) return; - } - - file.seekg(0, std::ios::end); - size_t size = file.tellg(); - std::string buffer(size, ' '); - file.seekg(0); - file.read(buffer.data(), size); - ryml::Tree tree = ryml::parse_in_arena(ryml::to_csubstr(buffer)); + ryml::Tree tree = ryml::parse_in_arena(ryml::to_csubstr(fileContents.Data())); ryml::NodeRef root = tree.rootref(); if (root.has_child(NUM_THREADS_STR) && root[NUM_THREADS_STR].val().is_integer())