More wxString conversion cleanup.

This commit is contained in:
Jordan Woyak 2013-03-03 02:30:45 -06:00
parent aeb4fc9846
commit fad2b65d76
2 changed files with 6 additions and 22 deletions

View File

@ -966,8 +966,7 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
if (!iso)
return;
wxString strPath(iso->GetFileName().c_str(), wxConvUTF8);
wxFileName path = wxFileName::FileName(strPath);
wxFileName path = wxFileName::FileName(StrToWxStr(iso->GetFileName()));
path.MakeAbsolute();
WxUtils::Explore(path.GetPath().char_str());
}

View File

@ -704,26 +704,11 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
std::string title = memoryCard[card]->GetSaveComment1(fileIndex);
std::string comment = memoryCard[card]->GetSaveComment2(fileIndex);
bool ascii = memoryCard[card]->IsAsciiEncoding();
#ifdef _WIN32
wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent);
static bool validCP932 = ::IsValidCodePage(932) != 0;
if (validCP932)
{
SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
}
else
{
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
}
#else
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
// it returns CP-932, in order to use iconv we need to use CP932
wxCSConv SJISConv(wxT("CP932"));
#endif
wxTitle = wxString(title.c_str(), ascii ? *wxConvCurrent : SJISConv);
wxComment = wxString(comment.c_str(), ascii ? *wxConvCurrent : SJISConv);
auto const string_decoder = memoryCard[card]->IsAsciiEncoding() ?
CP1252ToUTF8 : SHIFTJISToUTF8;
wxTitle = StrToWxStr(string_decoder(title));
wxComment = StrToWxStr(string_decoder(comment));
m_MemcardList[card]->SetItem(index, COLUMN_TITLE, wxTitle);
m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxComment);