aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authorSatoshi Nakamoto <satoshin@gmx.com>2010-07-26 17:44:51 +0000
committerGavin Andresen <gavinandresen@gmail.com>2010-07-26 17:44:51 +0000
commitb6dc3b517b74ef2baa0e707f837a65b4ff5a6f2e (patch)
tree757fa9f209b9cb6a42c6b6e6df9e58cad074cd03 /util.cpp
parentf0c11b1917009f1648eb42f1d17f35196fb7c539 (diff)
downloadbitcoin-b6dc3b517b74ef2baa0e707f837a65b4ff5a6f2e.tar.xz
bitcoind now compiles without wxWidgets or wxBase
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/util.cpp b/util.cpp
index 1c9f86141a..87c9037ae0 100644
--- a/util.cpp
+++ b/util.cpp
@@ -134,7 +134,7 @@ uint64 GetRand(uint64 nMax)
inline int OutputDebugStringF(const char* pszFormat, ...)
{
int ret = 0;
- if (fPrintToConsole || wxTheApp == NULL)
+ if (fPrintToConsole)
{
// print to console
va_list arg_ptr;
@@ -441,6 +441,7 @@ void ParseParameters(int argc, char* argv[])
const char* wxGetTranslation(const char* pszEnglish)
{
+#ifdef GUI
// Wrapper of wxGetTranslation returning the same const char* type as was passed in
static CCriticalSection cs;
CRITICAL_BLOCK(cs)
@@ -467,6 +468,9 @@ const char* wxGetTranslation(const char* pszEnglish)
return pszCached;
}
return NULL;
+#else
+ return pszEnglish;
+#endif
}
@@ -485,8 +489,6 @@ void FormatException(char* pszMessage, std::exception* pex, const char* pszThrea
pszModule[0] = '\0';
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else
- // might not be thread safe, uses wxString
- //const char* pszModule = wxStandardPaths::Get().GetExecutablePath().mb_str();
const char* pszModule = "bitcoin";
#endif
if (pex)
@@ -510,8 +512,10 @@ void PrintException(std::exception* pex, const char* pszThread)
FormatException(pszMessage, pex, pszThread);
printf("\n\n************************\n%s\n", pszMessage);
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
- if (wxTheApp && !fDaemon && fGUI)
+#ifdef GUI
+ if (wxTheApp && !fDaemon)
MyMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
+#endif
throw;
//DebugBreak();
}
@@ -574,10 +578,10 @@ string GetDefaultDataDir()
string strHome = pszHome;
if (strHome[strHome.size()-1] != '/')
strHome += '/';
-#ifdef __WXOSX__
+#ifdef __WXMAC_OSX__
// Mac
strHome += "Library/Application Support/";
- _mkdir(strHome.c_str());
+ filesystem::create_directory(strHome.c_str());
return strHome + "Bitcoin";
#else
// Unix
@@ -596,7 +600,7 @@ void GetDataDir(char* pszDir)
if (!fMkdirDone)
{
fMkdirDone = true;
- _mkdir(pszDir);
+ filesystem::create_directory(pszDir);
}
}
else
@@ -606,9 +610,8 @@ void GetDataDir(char* pszDir)
static char pszCachedDir[MAX_PATH];
if (pszCachedDir[0] == 0)
{
- //strlcpy(pszCachedDir, wxStandardPaths::Get().GetUserDataDir().c_str(), sizeof(pszCachedDir));
strlcpy(pszCachedDir, GetDefaultDataDir().c_str(), sizeof(pszCachedDir));
- _mkdir(pszCachedDir);
+ filesystem::create_directory(pszCachedDir);
}
strlcpy(pszDir, pszCachedDir, MAX_PATH);
}