aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-26 17:15:18 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-26 17:15:18 +0000
commit793200e5e918a6e993ddf701967a8b6535a6828f (patch)
treee983c5b11c032a309edb230f8694225aef478d98 /util.cpp
parent6966768a554575ca329fbcd4aad0d4f21c702f9a (diff)
bitcoind now compiles without wxWidgets or wxBase
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@112 1a98c847-1fd6-4fd8-948a-caf3550aa51b
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 5d3728a135..7cb6600fd1 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);
}