Skip to content

Commit

Permalink
The previous fix required Boost >= 1.60.0 which seemed too big a
Browse files Browse the repository at this point in the history
constraint. An alternative fix has been implemented which should work on
all platforms without additional dependencies.
  • Loading branch information
JusticeRage committed May 23, 2016
1 parent 1d50cdb commit 26a77e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
5 changes: 0 additions & 5 deletions include/manape/resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
#include <vector>
#include <sstream>

// Used to write unicode STRING_TABLEs to files.
#include <fstream>
#include <locale>
#include <boost/locale/utf8_codecvt.hpp>

#include <boost/cstdint.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_array.hpp>
Expand Down
26 changes: 10 additions & 16 deletions manape/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,22 +691,16 @@ bool Resource::extract(const boost::filesystem::path& destination)
return true;
}

std::wofstream out(destination.wstring(), std::ios_base::out | std::ios_base::app);
const std::locale utf8_locale = std::locale(std::locale(), new boost::locale::utf8_codecvt<wchar_t>());
out.imbue(utf8_locale);
if (out.fail())
{
PRINT_ERROR << "Could not open/create " << destination << "!" << std::endl;
return false;
}

for (auto it2 = strings->begin(); it2 != strings->end(); ++it2)
{
if (*it2 != L"") {
out << *it2 << std::endl;
}
}
out.close();
FILE* out = fopen(destination.string().c_str(), "a+,ccs=UTF-8");
for (auto it2 = strings->begin(); it2 != strings->end(); ++it2)
{
if (*it2 != L"")
{
fwrite(it2->c_str(), wcslen(it2->c_str()) * sizeof(wchar_t), 1, out);
fwrite(L"\n", 1, 2, out);
}
}
fclose(out);
return true;
}
else {
Expand Down

0 comments on commit 26a77e8

Please sign in to comment.