mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-02 23:54:10 +00:00
open fstreams from boost::filesystem::path, vol.1
This commit is contained in:
parent
18b3cfebdb
commit
a22ec223d8
@ -1,6 +1,6 @@
|
|||||||
#include "unshieldthread.hpp"
|
#include "unshieldthread.hpp"
|
||||||
|
|
||||||
#include <fstream>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
namespace bfs = boost::filesystem;
|
namespace bfs = boost::filesystem;
|
||||||
@ -49,7 +49,7 @@ namespace
|
|||||||
|
|
||||||
std::string read_to_string(const bfs::path& path)
|
std::string read_to_string(const bfs::path& path)
|
||||||
{
|
{
|
||||||
std::ifstream strstream(path.c_str(), std::ios::in | std::ios::binary);
|
bfs::ifstream strstream(path, std::ios::in | std::ios::binary);
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
strstream.seekg(0, std::ios::end);
|
strstream.seekg(0, std::ios::end);
|
||||||
@ -201,7 +201,7 @@ namespace
|
|||||||
add_setting("Archives", "Archive 1", "Bloodmoon.bsa", ini);
|
add_setting("Archives", "Archive 1", "Bloodmoon.bsa", ini);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ofstream inistream(ini_path.c_str());
|
bfs::ofstream inistream(ini_path)
|
||||||
inistream << ini;
|
inistream << ini;
|
||||||
inistream.close();
|
inistream.close();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
#include <components/compiler/exception.hpp>
|
#include <components/compiler/exception.hpp>
|
||||||
#include <components/compiler/extensions0.hpp>
|
#include <components/compiler/extensions0.hpp>
|
||||||
|
|
||||||
@ -194,7 +197,8 @@ namespace MWGui
|
|||||||
|
|
||||||
void Console::executeFile (const std::string& path)
|
void Console::executeFile (const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream stream (path.c_str());
|
namespace bfs = boost::filesystem;
|
||||||
|
bfs::ifstream stream (bfs::path(path));
|
||||||
|
|
||||||
if (!stream.is_open())
|
if (!stream.is_open())
|
||||||
printError ("failed to open file: " + path);
|
printError ("failed to open file: " + path);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "configurationmanager.hpp"
|
#include "configurationmanager.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/algorithm/string/erase.hpp>
|
#include <boost/algorithm/string/erase.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \namespace Files
|
* \namespace Files
|
||||||
@ -125,7 +125,7 @@ void ConfigurationManager::loadConfig(const boost::filesystem::path& path,
|
|||||||
{
|
{
|
||||||
std::cout << "Loading config file: " << cfgFile.string() << "... ";
|
std::cout << "Loading config file: " << cfgFile.string() << "... ";
|
||||||
|
|
||||||
std::ifstream configFileStream(cfgFile.string().c_str());
|
boost::filesystem::ifstream configFileStream(cfgFile);
|
||||||
if (configFileStream.is_open())
|
if (configFileStream.is_open())
|
||||||
{
|
{
|
||||||
boost::program_options::store(boost::program_options::parse_config_file(
|
boost::program_options::store(boost::program_options::parse_config_file(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user