diff --git a/CHANGELOG.md b/CHANGELOG.md index 67a2632b93..ebda3d4f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -185,6 +185,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 diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index a54c133340..36512579ce 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -2,6 +2,7 @@ #include +#include #include #include @@ -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); diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 03693ddfe2..3a20555d1e 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -1,7 +1,6 @@ #include "document.hpp" #include -#include #include #include @@ -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"; - - std::ofstream destination (mProjectPath.string().c_str(), std::ios::binary); - - 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(); - } + boost::filesystem::path filtersPath (configuration.getUserDataPath() / "defaultfilters"); + + 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 (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) diff --git a/components/detournavigator/debug.cpp b/components/detournavigator/debug.cpp index 0ddf002d90..c3d67b1848 100644 --- a/components/detournavigator/debug.cpp +++ b/components/detournavigator/debug.cpp @@ -4,14 +4,15 @@ #include -#include +#include +#include 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);