mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 20:09:41 +00:00
Merge pull request #2651 from akortunov/encoding
Unify streams usage to support non-ASCII paths
This commit is contained in:
commit
ff2739b8a3
4 changed files with 21 additions and 16 deletions
|
@ -187,6 +187,7 @@
|
|||
Bug #5223: Bow replacement during attack animation removes attached arrow
|
||||
Bug #5226: Reputation should be capped
|
||||
Bug #5229: Crash if mesh controller node has no data node
|
||||
Bug #5239: OpenMW-CS does not support non-ASCII characters in path names
|
||||
Feature #1774: Handle AvoidNode
|
||||
Feature #2229: Improve pathfinding AI
|
||||
Feature #3025: Analogue gamepad movement controls
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <iomanip>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
@ -349,7 +350,7 @@ namespace ESSImport
|
|||
|
||||
writer.setFormat (ESM::SavedGame::sCurrentFormat);
|
||||
|
||||
std::ofstream stream(mOutFile.c_str(), std::ios::binary);
|
||||
boost::filesystem::ofstream stream(boost::filesystem::path(mOutFile), std::ios::out | std::ios::binary);
|
||||
// all unused
|
||||
writer.setVersion(0);
|
||||
writer.setType(0);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "document.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
@ -289,19 +288,22 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
|
||||
if (mNew || !boost::filesystem::exists (mProjectPath))
|
||||
{
|
||||
boost::filesystem::path customFiltersPath (configuration.getUserDataPath());
|
||||
customFiltersPath /= "defaultfilters";
|
||||
boost::filesystem::path filtersPath (configuration.getUserDataPath() / "defaultfilters");
|
||||
|
||||
std::ofstream destination (mProjectPath.string().c_str(), std::ios::binary);
|
||||
boost::filesystem::ofstream destination(mProjectPath, std::ios::out | std::ios::binary);
|
||||
if (!destination.is_open())
|
||||
throw std::runtime_error("Can not create project file: " + mProjectPath.string());
|
||||
destination.exceptions(std::ios::failbit | std::ios::badbit);
|
||||
|
||||
if (boost::filesystem::exists (customFiltersPath))
|
||||
{
|
||||
destination << std::ifstream(customFiltersPath.string().c_str(), std::ios::binary).rdbuf();
|
||||
}
|
||||
else
|
||||
{
|
||||
destination << std::ifstream(std::string(mResDir.string() + "/defaultfilters").c_str(), std::ios::binary).rdbuf();
|
||||
}
|
||||
if (!boost::filesystem::exists (filtersPath))
|
||||
filtersPath = mResDir / "defaultfilters";
|
||||
|
||||
boost::filesystem::ifstream source(filtersPath, std::ios::in | std::ios::binary);
|
||||
if (!source.is_open())
|
||||
throw std::runtime_error("Can not read filters file: " + filtersPath.string());
|
||||
source.exceptions(std::ios::failbit | std::ios::badbit);
|
||||
|
||||
destination << source.rdbuf();
|
||||
}
|
||||
|
||||
if (mNew)
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
#include <DetourNavMesh.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
void writeToFile(const RecastMesh& recastMesh, const std::string& pathPrefix, const std::string& revision)
|
||||
{
|
||||
const auto path = pathPrefix + "recastmesh" + revision + ".obj";
|
||||
std::ofstream file(path);
|
||||
boost::filesystem::ofstream file(boost::filesystem::path(path), std::ios::out);
|
||||
if (!file.is_open())
|
||||
throw NavigatorException("Open file failed: " + path);
|
||||
file.exceptions(std::ios::failbit | std::ios::badbit);
|
||||
|
@ -64,7 +65,7 @@ namespace DetourNavigator
|
|||
};
|
||||
|
||||
const auto path = pathPrefix + "all_tiles_navmesh" + revision + ".bin";
|
||||
std::ofstream file(path, std::ios::binary);
|
||||
boost::filesystem::ofstream file(boost::filesystem::path(path), std::ios::out | std::ios::binary);
|
||||
if (!file.is_open())
|
||||
throw NavigatorException("Open file failed: " + path);
|
||||
file.exceptions(std::ios::failbit | std::ios::badbit);
|
||||
|
|
Loading…
Reference in a new issue