open fstreams from boost::filesystem::path, vol.2

deque
greye 11 years ago
parent 2236216344
commit 424d06a6f8

@ -1,7 +1,8 @@
#include "settings.hpp" #include "settings.hpp"
#include <fstream>
#include <stdexcept> #include <stdexcept>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <OgreResourceGroupManager.h> #include <OgreResourceGroupManager.h>
#include <OgreStringConverter.h> #include <OgreStringConverter.h>
@ -25,7 +26,8 @@ void Manager::loadDefault (const std::string& file)
void Manager::saveUser(const std::string& file) void Manager::saveUser(const std::string& file)
{ {
std::fstream fout(file.c_str(), std::ios::out); namespace bfs = boost::filesystem;
bfs::ofstream fout(bfs::path(file));
Ogre::ConfigFile::SectionIterator seci = mFile.getSectionIterator(); Ogre::ConfigFile::SectionIterator seci = mFile.getSectionIterator();

@ -1,7 +1,8 @@
#include "translation.hpp" #include "translation.hpp"
#include <components/misc/stringops.hpp>
#include <fstream> #include <boost/filesystem/fstream.hpp>
#include <components/misc/stringops.hpp>
namespace Translation namespace Translation
{ {
@ -28,9 +29,8 @@ namespace Translation
if (dataFileCollections.getCollection (extension).doesExist (fileName)) if (dataFileCollections.getCollection (extension).doesExist (fileName))
{ {
std::string path = dataFileCollections.getCollection (extension).getPath (fileName).string(); boost::filesystem::ifstream stream (
dataFileCollections.getCollection (extension).getPath (fileName));
std::ifstream stream (path.c_str());
if (!stream.is_open()) if (!stream.is_open())
throw std::runtime_error ("failed to open translation file: " + fileName); throw std::runtime_error ("failed to open translation file: " + fileName);

Loading…
Cancel
Save