summaryrefslogtreecommitdiff
path: root/shared/systemFunctions.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:00:17 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:00:17 +0200
commitfd0853d2623dd278b08288331ed42e3be59252fb (patch)
treea7645daeaef8bdbed064faf4eb88e72cee58726c /shared/systemFunctions.cpp
parent2.1 (diff)
downloadFreeFileSync-fd0853d2623dd278b08288331ed42e3be59252fb.tar.gz
FreeFileSync-fd0853d2623dd278b08288331ed42e3be59252fb.tar.bz2
FreeFileSync-fd0853d2623dd278b08288331ed42e3be59252fb.zip
2.2
Diffstat (limited to 'shared/systemFunctions.cpp')
-rw-r--r--shared/systemFunctions.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/shared/systemFunctions.cpp b/shared/systemFunctions.cpp
new file mode 100644
index 00000000..4fd17fc1
--- /dev/null
+++ b/shared/systemFunctions.cpp
@@ -0,0 +1,37 @@
+#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(const unsigned long lastError) //try to get additional Windows error information
+{
+ //determine error code if none was specified
+ const unsigned long lastErrorCode = lastError == 0 ? ::GetLastError() : lastError;
+
+ wxString output = wxString(wxT("Windows Error Code ")) + wxString::Format(wxT("%u"), lastErrorCode);
+
+ WCHAR buffer[1001];
+ if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, 0, lastErrorCode, 0, buffer, 1001, NULL) != 0)
+ output += wxString(wxT(": ")) + buffer;
+ return output;
+}
+
+#elif defined FFS_LINUX
+wxString FreeFileSync::getLastErrorFormatted(const int lastError) //try to get additional Linux error information
+{
+ //determine error code if none was specified
+ const int lastErrorCode = lastError == 0 ? errno : lastError;
+
+ wxString output = wxString(wxT("Linux Error Code ")) + wxString::Format(wxT("%i"), lastErrorCode);
+ output += wxString(wxT(": ")) + ::strerror(lastErrorCode);
+ return output;
+}
+#endif
bgstack15