load Ogre::ConfigFile from DataStream

deque
greye 11 years ago
parent e02b04536f
commit 2c82da8e6e

@ -6,9 +6,12 @@
#include <OgreResourceGroupManager.h> #include <OgreResourceGroupManager.h>
#include <OgreStringConverter.h> #include <OgreStringConverter.h>
#include <OgreDataStream.h>
using namespace Settings; using namespace Settings;
namespace bfs = boost::filesystem;
Ogre::ConfigFile Manager::mFile = Ogre::ConfigFile(); Ogre::ConfigFile Manager::mFile = Ogre::ConfigFile();
Ogre::ConfigFile Manager::mDefaultFile = Ogre::ConfigFile(); Ogre::ConfigFile Manager::mDefaultFile = Ogre::ConfigFile();
CategorySettingVector Manager::mChangedSettings = CategorySettingVector(); CategorySettingVector Manager::mChangedSettings = CategorySettingVector();
@ -16,17 +19,20 @@ CategorySettingValueMap Manager::mNewSettings = CategorySettingValueMap();
void Manager::loadUser (const std::string& file) 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) 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) void Manager::saveUser(const std::string& file)
{ {
namespace bfs = boost::filesystem;
bfs::ofstream fout((bfs::path(file))); bfs::ofstream fout((bfs::path(file)));
Ogre::ConfigFile::SectionIterator seci = mFile.getSectionIterator(); Ogre::ConfigFile::SectionIterator seci = mFile.getSectionIterator();

Loading…
Cancel
Save