From 2c82da8e6e5d535e2032c8e21150d7a8d3a60f07 Mon Sep 17 00:00:00 2001 From: greye Date: Mon, 19 May 2014 10:07:43 +0400 Subject: [PATCH] load Ogre::ConfigFile from DataStream --- components/settings/settings.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index ac09db9d9..56e937c8e 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -6,9 +6,12 @@ #include #include +#include using namespace Settings; +namespace bfs = boost::filesystem; + Ogre::ConfigFile Manager::mFile = Ogre::ConfigFile(); Ogre::ConfigFile Manager::mDefaultFile = Ogre::ConfigFile(); CategorySettingVector Manager::mChangedSettings = CategorySettingVector(); @@ -16,17 +19,20 @@ CategorySettingValueMap Manager::mNewSettings = CategorySettingValueMap(); void Manager::loadUser (const std::string& file) { - mFile.load(file); + bfs::ifstream fin((bfs::path(file))); + Ogre::DataStreamPtr stream((OGRE_NEW Ogre::FileStreamDataStream(file, &fin, false))); + mFile.load(stream); } void Manager::loadDefault (const std::string& file) { - mDefaultFile.load(file); + bfs::ifstream fin((bfs::path(file))); + Ogre::DataStreamPtr stream((OGRE_NEW Ogre::FileStreamDataStream(file, &fin, false))); + mDefaultFile.load(stream); } void Manager::saveUser(const std::string& file) { - namespace bfs = boost::filesystem; bfs::ofstream fout((bfs::path(file))); Ogre::ConfigFile::SectionIterator seci = mFile.getSectionIterator();