1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 08:06:41 +00:00

fix OpenCS saving to Unicode path destination

This commit is contained in:
greye 2014-05-19 15:52:19 +04:00
parent 9c6224c74d
commit db16bb8983
3 changed files with 8 additions and 7 deletions

View file

@ -27,7 +27,7 @@ void CSMDoc::OpenSaveStage::perform (int stage, Messages& messages)
{ {
mState.start (mDocument, mProjectFile); mState.start (mDocument, mProjectFile);
mState.getStream().open ((mProjectFile ? mState.getPath() : mState.getTmpPath()).string().c_str()); mState.getStream().open (mProjectFile ? mState.getPath() : mState.getTmpPath());
if (!mState.getStream().is_open()) if (!mState.getStream().is_open())
throw std::runtime_error ("failed to open stream for saving"); throw std::runtime_error ("failed to open stream for saving");
@ -260,4 +260,4 @@ void CSMDoc::FinalSavingStage::perform (int stage, Messages& messages)
mDocument.getUndoStack().setClean(); mDocument.getUndoStack().setClean();
} }
} }

View file

@ -47,7 +47,7 @@ const boost::filesystem::path& CSMDoc::SavingState::getTmpPath() const
return mTmpPath; return mTmpPath;
} }
std::ofstream& CSMDoc::SavingState::getStream() boost::filesystem::ofstream& CSMDoc::SavingState::getStream()
{ {
return mStream; return mStream;
} }
@ -60,4 +60,4 @@ ESM::ESMWriter& CSMDoc::SavingState::getWriter()
bool CSMDoc::SavingState::isProjectFile() const bool CSMDoc::SavingState::isProjectFile() const
{ {
return mProjectFile; return mProjectFile;
} }

View file

@ -4,6 +4,7 @@
#include <fstream> #include <fstream>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <components/esm/esmwriter.hpp> #include <components/esm/esmwriter.hpp>
@ -20,7 +21,7 @@ namespace CSMDoc
boost::filesystem::path mPath; boost::filesystem::path mPath;
boost::filesystem::path mTmpPath; boost::filesystem::path mTmpPath;
ToUTF8::Utf8Encoder mEncoder; ToUTF8::Utf8Encoder mEncoder;
std::ofstream mStream; boost::filesystem::ofstream mStream;
ESM::ESMWriter mWriter; ESM::ESMWriter mWriter;
boost::filesystem::path mProjectPath; boost::filesystem::path mProjectPath;
bool mProjectFile; bool mProjectFile;
@ -39,7 +40,7 @@ namespace CSMDoc
const boost::filesystem::path& getTmpPath() const; const boost::filesystem::path& getTmpPath() const;
std::ofstream& getStream(); boost::filesystem::ofstream& getStream();
ESM::ESMWriter& getWriter(); ESM::ESMWriter& getWriter();
@ -50,4 +51,4 @@ namespace CSMDoc
} }
#endif #endif