switched from wxStandardPaths to GetDefaultDataDir, fixes bug reported by m0mchil when username contains non-lower-ASCII characters

-- version 0.3.1
This commit is contained in:
s_nakamoto 2010-07-09 15:29:48 +00:00
parent c8063ff034
commit f32339e700
4 changed files with 6 additions and 14 deletions

View file

@ -4,8 +4,6 @@
#include "headers.h" #include "headers.h"
extern string GetDefaultDataDir(); /// todo: delete this later, just used by debug test
@ -430,15 +428,7 @@ bool CMyApp::OnInit2()
printf("Bitcoin version %d.%d.%d%s beta, OS version %s\n", VERSION/10000, (VERSION/100)%100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str()); printf("Bitcoin version %d.%d.%d%s beta, OS version %s\n", VERSION/10000, (VERSION/100)%100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str());
printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str()); printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str());
printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str()); printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str());
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
/// debug - for now, just watching if these match
if (pszSetDataDir[0] == 0)
{
if (GetDefaultDataDir() != GetDataDir())
printf("**** GetDefaultDataDir() %s != %s\n", GetDefaultDataDir().c_str(), GetDataDir().c_str());
else
printf("OK GetDefaultDataDir() %s == %s\n", GetDefaultDataDir().c_str(), GetDataDir().c_str());
}
if (mapArgs.count("-loadblockindextest")) if (mapArgs.count("-loadblockindextest"))
{ {

View file

@ -19,8 +19,8 @@ class CScript;
class CDataStream; class CDataStream;
class CAutoFile; class CAutoFile;
static const int VERSION = 300; static const int VERSION = 301;
static const char* pszSubVer = ".2"; static const char* pszSubVer = ".0";

View file

@ -604,7 +604,8 @@ void GetDataDir(char* pszDir)
static char pszCachedDir[MAX_PATH]; static char pszCachedDir[MAX_PATH];
if (pszCachedDir[0] == 0) if (pszCachedDir[0] == 0)
{ {
strlcpy(pszCachedDir, wxStandardPaths::Get().GetUserDataDir().c_str(), sizeof(pszCachedDir)); //strlcpy(pszCachedDir, wxStandardPaths::Get().GetUserDataDir().c_str(), sizeof(pszCachedDir));
strlcpy(pszCachedDir, GetDefaultDataDir().c_str(), sizeof(pszCachedDir));
_mkdir(pszCachedDir); _mkdir(pszCachedDir);
} }
strlcpy(pszDir, pszCachedDir, MAX_PATH); strlcpy(pszDir, pszCachedDir, MAX_PATH);

1
util.h
View file

@ -144,6 +144,7 @@ void GetDataDir(char* pszDirRet);
#ifdef __WXMSW__ #ifdef __WXMSW__
string MyGetSpecialFolderPath(int nFolder, bool fCreate); string MyGetSpecialFolderPath(int nFolder, bool fCreate);
#endif #endif
string GetDefaultDataDir();
string GetDataDir(); string GetDataDir();
void ShrinkDebugFile(); void ShrinkDebugFile();
uint64 GetRand(uint64 nMax); uint64 GetRand(uint64 nMax);