diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:12:46 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:12:46 +0200 |
commit | b338e29fd3eaf700f8c8360aa0310048ba941d54 (patch) | |
tree | 122f8ef3790d12cd10275ef7453a9e8053322d78 /shared/last_error.cpp | |
parent | 3.18 (diff) | |
download | FreeFileSync-b338e29fd3eaf700f8c8360aa0310048ba941d54.tar.gz FreeFileSync-b338e29fd3eaf700f8c8360aa0310048ba941d54.tar.bz2 FreeFileSync-b338e29fd3eaf700f8c8360aa0310048ba941d54.zip |
3.19
Diffstat (limited to 'shared/last_error.cpp')
-rw-r--r-- | shared/last_error.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/shared/last_error.cpp b/shared/last_error.cpp index 8109b669..ea8345bc 100644 --- a/shared/last_error.cpp +++ b/shared/last_error.cpp @@ -5,7 +5,7 @@ // ************************************************************************** // #include "last_error.h" -#include "string_tools.h" +#include "string_utf8.h" #include "i18n.h" #ifdef FFS_WIN @@ -16,17 +16,18 @@ #include <cerrno> #endif +using namespace zen; #ifdef FFS_WIN -wxString zen::getLastErrorFormatted(unsigned long lastError) //try to get additional Windows error information +std::wstring zen::getLastErrorFormatted(unsigned long lastError) //try to get additional Windows error information { //determine error code if none was specified if (lastError == 0) lastError = ::GetLastError(); - wxString output = _("Windows Error Code %x:"); - output.Replace(wxT("%x"), zen::toString<wxString>(lastError)); + std::wstring output = _("Windows Error Code %x:"); + replace(output, L"%x", toString<std::wstring>(lastError)); LPWSTR buffer = NULL; if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | @@ -36,7 +37,7 @@ wxString zen::getLastErrorFormatted(unsigned long lastError) //try to get additi { if (buffer) //just to be sure { - output += wxT(" "); + output += L" "; output += buffer; ::LocalFree(buffer); } @@ -46,16 +47,17 @@ wxString zen::getLastErrorFormatted(unsigned long lastError) //try to get additi } #elif defined FFS_LINUX -wxString zen::getLastErrorFormatted(int lastError) //try to get additional Linux error information +std::wstring zen::getLastErrorFormatted(int lastError) //try to get additional Linux error information { //determine error code if none was specified if (lastError == 0) lastError = errno; //don't use "::", errno is a macro! - wxString output = _("Linux Error Code %x:"); - output.Replace(wxT("%x"), zen::toString<wxString>(lastError)); + std::wstring output = _("Linux Error Code %x:"); + replace(output, L"%x", toString<std::wstring>(lastError)); - output += wxT(" ") + wxString::FromUTF8(::strerror(lastError)); + output += L" "; + output += utf8CvrtTo<std::wstring>(::strerror(lastError)); errno = lastError; //restore errno return output; |