blob: 6d945d67d9b83be0f98524ef87afcc1812a43ee2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
//
#include "systemFunctions.h"
#ifdef FFS_WIN
#include <wx/msw/wrapwin.h> //includes "windows.h"
#elif defined FFS_LINUX
#include <string.h>
#include <errno.h>
#endif
#ifdef FFS_WIN
wxString FreeFileSync::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 = wxString(wxT("Windows Error Code ")) + wxString::Format(wxT("%u"), lastError);
WCHAR buffer[1001];
if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, 0, lastError, 0, buffer, 1001, NULL) != 0)
output += wxString(wxT(": ")) + buffer;
return output;
}
#elif defined FFS_LINUX
wxString FreeFileSync::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 = wxString(wxT("Linux Error Code ")) + wxString::Format(wxT("%i"), lastError);
output += wxString(wxT(": ")) + wxString::FromUTF8(::strerror(lastError));
return output;
}
#endif
|