save header and brush previews in same name folder when exporting ppbr

This commit is contained in:
2019-09-14 14:15:17 +02:00
parent 6f6be42a01
commit f75748185a
4 changed files with 50 additions and 25 deletions

View File

@@ -571,22 +571,28 @@ std::string unescape(const std::string& s)
std::wstring str2wstr(const std::string& str)
{
mbstate_t st = {};
std::wstring converted;
converted.resize(str.size());
const char* ptr = str.c_str();
std::mbsrtowcs((wchar_t*)converted.data(), &ptr, converted.capacity(), &st);
return converted;
//mbstate_t st = {};
//std::wstring converted;
//converted.resize(str.size());
//const char* ptr = str.c_str();
//std::mbsrtowcs((wchar_t*)converted.data(), &ptr, converted.capacity(), &st);
//return converted;
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
return converterX.from_bytes(str);
}
std::string wstr2str(const std::wstring & wstr)
{
mbstate_t st = {};
std::string converted;
converted.resize(wstr.size());
const wchar_t * wptr = wstr.c_str();
std::wcsrtombs((char*)converted.data(), &wptr, converted.capacity(), &st);
return converted;
//mbstate_t st = {};
//std::string converted;
//converted.resize(wstr.size());
//const wchar_t * wptr = wstr.c_str();
//std::wcsrtombs((char*)converted.data(), &wptr, converted.capacity(), &st);
//return converted;
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
return converterX.to_bytes(wstr);
}
bool str_iequals(const std::string& a, const std::string& b)