From 424d06a6f88906b4d10f76060c4cd0032440d150 Mon Sep 17 00:00:00 2001 From: greye Date: Sun, 19 Jan 2014 15:20:08 +0400 Subject: [PATCH] open fstreams from boost::filesystem::path, vol.2 --- components/settings/settings.cpp | 6 ++++-- components/translation/translation.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 13015e39c9..3a3a3dddda 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -1,7 +1,8 @@ #include "settings.hpp" -#include #include +#include +#include #include #include @@ -25,7 +26,8 @@ void Manager::loadDefault (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(); diff --git a/components/translation/translation.cpp b/components/translation/translation.cpp index d0ea4b7fb6..423c3971a0 100644 --- a/components/translation/translation.cpp +++ b/components/translation/translation.cpp @@ -1,7 +1,8 @@ #include "translation.hpp" -#include -#include +#include + +#include namespace Translation { @@ -28,9 +29,8 @@ namespace Translation if (dataFileCollections.getCollection (extension).doesExist (fileName)) { - std::string path = dataFileCollections.getCollection (extension).getPath (fileName).string(); - - std::ifstream stream (path.c_str()); + boost::filesystem::ifstream stream ( + dataFileCollections.getCollection (extension).getPath (fileName)); if (!stream.is_open()) throw std::runtime_error ("failed to open translation file: " + fileName);