Display patch errors/warnings in UTF-8, issue #261

--HG--
branch : develop
This commit is contained in:
kervala 2016-02-20 18:59:03 +01:00
parent baecfcf944
commit 6e54ba6420
2 changed files with 11 additions and 11 deletions

View file

@ -1787,7 +1787,7 @@ class CAHReboot : public IActionHandler
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
im->messageBoxWithHelp(ucstring(e.what()), "ui:login", "login_quit"); im->messageBoxWithHelp(ucstring::makeFromUtf8(e.what()), "ui:login", "login_quit");
} }
} }
}; };

View file

@ -698,7 +698,7 @@ bool CPatchManager::getThreadState (ucstring &stateOut, vector<ucstring> &stateL
// verbose log // verbose log
if (isVerboseLog() && !stateLogOut.empty()) if (isVerboseLog() && !stateLogOut.empty())
for (uint32 i = 0; i < stateLogOut.size(); ++i) for (uint32 i = 0; i < stateLogOut.size(); ++i)
nlinfo("%s", stateLogOut[i].toString().c_str()); nlinfo("%s", stateLogOut[i].toUtf8().c_str());
return changed; return changed;
} }
@ -1025,7 +1025,7 @@ void CPatchManager::setRWAccess (const string &filename, bool bThrowException)
{ {
s = CI18N::get("uiAttribErr") + " " + CFile::getFilename(filename) + " (" + toString(errno) + "," + strerror(errno) + ")"; s = CI18N::get("uiAttribErr") + " " + CFile::getFilename(filename) + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s); setState(true, s);
throw Exception (s.toString()); throw Exception (s.toUtf8());
} }
} }
@ -1039,7 +1039,7 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException,
{ {
s = CI18N::get("uiDelNoFile"); s = CI18N::get("uiDelNoFile");
setState(true, s); setState(true, s);
return s.toString(); return s.toUtf8();
} }
if (!NLMISC::CFile::deleteFile(filename)) if (!NLMISC::CFile::deleteFile(filename))
@ -1048,8 +1048,8 @@ string CPatchManager::deleteFile (const string &filename, bool bThrowException,
if(bWarning) if(bWarning)
setState(true, s); setState(true, s);
if(bThrowException) if(bThrowException)
throw Exception (s.toString()); throw Exception (s.toUtf8());
return s.toString(); return s.toUtf8();
} }
return ""; return "";
} }
@ -1064,7 +1064,7 @@ void CPatchManager::renameFile (const string &src, const string &dst)
{ {
s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")"; s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s); setState(true, s);
throw Exception (s.toString()); throw Exception (s.toUtf8());
} }
} }
@ -1744,7 +1744,7 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v
if (!bnpFile.readHeader()) if (!bnpFile.readHeader())
{ {
ucstring s = CI18N::get("uiUnpackErrHead") + " " + SourceName; ucstring s = CI18N::get("uiUnpackErrHead") + " " + CFile::getFilename(SourceName);
setState(true,s); setState(true,s);
return false; return false;
} }
@ -1805,7 +1805,7 @@ void CPatchManager::MyPatchingCB::progress(float f)
{ {
CPatchManager *pPM = CPatchManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance();
double p = 100.0*f; double p = 100.0*f;
ucstring sTranslate = CI18N::get("uiApplyingDelta") + toString(" %s (%5.02f %%)", CFile::getFilename(patchFilename).c_str(), p); ucstring sTranslate = CI18N::get("uiApplyingDelta") + ucstring::makeFromUtf8(toString(" %s (%.02f %%)", CFile::getFilename(patchFilename).c_str(), p));
pPM->setState(false, sTranslate); pPM->setState(false, sTranslate);
} }
@ -1981,7 +1981,7 @@ void CPatchManager::clearDataScanLog()
// *************************************************************************** // ***************************************************************************
void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate) void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTranslate)
{ {
sTranslate = CI18N::get("uiCorruptedFile") + " " + ftp.FileName + " (" + sTranslate = CI18N::get("uiCorruptedFile") + " " + ucstring::makeFromUtf8(ftp.FileName) + " (" +
toString("%.1f ", (float)ftp.FinalFileSize/1000000.f) + CI18N::get("uiMb") + ")"; toString("%.1f ", (float)ftp.FinalFileSize/1000000.f) + CI18N::get("uiMb") + ")";
} }
@ -2068,7 +2068,7 @@ void CCheckThread::run ()
for (i = 0; i < rDescFiles.fileCount(); ++i) for (i = 0; i < rDescFiles.fileCount(); ++i)
{ {
CPatchManager::SFileToPatch ftp; CPatchManager::SFileToPatch ftp;
sTranslate = CI18N::get("uiCheckingFile") + " " + rDescFiles.getFile(i).getFileName(); sTranslate = CI18N::get("uiCheckingFile") + " " + ucstring::makeFromUtf8(rDescFiles.getFile(i).getFileName());
pPM->setState(true, sTranslate); pPM->setState(true, sTranslate);
// get list of patch to apply to this file. don't to a full checksum test if possible // get list of patch to apply to this file. don't to a full checksum test if possible
nlwarning(rDescFiles.getFile(i).getFileName().c_str()); nlwarning(rDescFiles.getFile(i).getFileName().c_str());