1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Serializer refactoring: fix FileStream usage for game loading

Miss this one rebase. Without this one non-English characters in paths to saves cause issues.
This commit is contained in:
Arseniy Shestakov 2016-10-30 15:14:59 +03:00
parent a1cca251ec
commit e79c522c4b
3 changed files with 11 additions and 9 deletions

View File

@ -15,7 +15,8 @@
extern template void registerTypes<BinaryDeserializer>(BinaryDeserializer & s);
CLoadFile::CLoadFile(const boost::filesystem::path & fname, int minimalVersion /*= version*/): serializer(this)
CLoadFile::CLoadFile(const boost::filesystem::path & fname, int minimalVersion /*= version*/)
: serializer(this)
{
registerTypes(serializer);
openNextFile(fname, minimalVersion);
@ -39,7 +40,7 @@ void CLoadFile::openNextFile(const boost::filesystem::path & fname, int minimalV
try
{
fName = fname.string();
sfile = make_unique<boost::filesystem::ifstream>(fname, std::ios::binary);
sfile = make_unique<FileStream>(fname, std::ios::in | std::ios::binary);
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
if(!(*sfile))

View File

@ -514,7 +514,7 @@ public:
BinaryDeserializer serializer;
std::string fName;
std::unique_ptr<boost::filesystem::ifstream> sfile;
std::unique_ptr<FileStream> sfile;
CLoadFile(const boost::filesystem::path & fname, int minimalVersion = SERIALIZATION_VERSION); //throws!
~CLoadFile();

View File

@ -15,7 +15,8 @@
extern template void registerTypes<BinarySerializer>(BinarySerializer & s);
CSaveFile::CSaveFile(const boost::filesystem::path &fname): serializer(this)
CSaveFile::CSaveFile(const boost::filesystem::path &fname)
: serializer(this)
{
registerTypes(serializer);
openNextFile(fname);