@ -5,9 +5,12 @@
# include "intro.h"
# include "intro.h"
# include "ui_intro.h"
# include "ui_intro.h"
# include "guiutil.h"
# include "util.h"
# include "util.h"
# include <boost/filesystem.hpp>
# include <boost/filesystem.hpp>
# include <QFileDialog>
# include <QFileDialog>
# include <QSettings>
# include <QSettings>
# include <QMessageBox>
# include <QMessageBox>
@ -59,7 +62,7 @@ void FreespaceChecker::check()
{
{
namespace fs = boost : : filesystem ;
namespace fs = boost : : filesystem ;
QString dataDirStr = intro - > getPathToCheck ( ) ;
QString dataDirStr = intro - > getPathToCheck ( ) ;
fs : : path dataDir = fs : : p ath( dataDirStr . toStdString ( ) ) ;
fs : : path dataDir = GUIUtil : : qstringToBoostP ath( dataDirStr ) ;
uint64_t freeBytesAvailable = 0 ;
uint64_t freeBytesAvailable = 0 ;
int replyStatus = ST_OK ;
int replyStatus = ST_OK ;
QString replyMessage = tr ( " A new data directory will be created. " ) ;
QString replyMessage = tr ( " A new data directory will be created. " ) ;
@ -143,7 +146,7 @@ void Intro::setDataDirectory(const QString &dataDir)
QString Intro : : getDefaultDataDirectory ( )
QString Intro : : getDefaultDataDirectory ( )
{
{
return QString : : fromStd String( GetDefaultDataDir ( ) . string ( ) ) ;
return GUIUtil : : boostPathToQ String( GetDefaultDataDir ( ) ) ;
}
}
void Intro : : pickDataDirectory ( )
void Intro : : pickDataDirectory ( )
@ -159,7 +162,7 @@ void Intro::pickDataDirectory()
/* 2) Allow QSettings to override default dir */
/* 2) Allow QSettings to override default dir */
dataDir = settings . value ( " strDataDir " , dataDir ) . toString ( ) ;
dataDir = settings . value ( " strDataDir " , dataDir ) . toString ( ) ;
if ( ! fs : : exists ( dataDir . toStdString ( ) ) | | GetBoolArg ( " -choosedatadir " , false ) )
if ( ! fs : : exists ( GUIUtil : : qstringToBoostPath ( dataDir ) ) | | GetBoolArg ( " -choosedatadir " , false ) )
{
{
/* If current default data directory does not exist, let the user choose one */
/* If current default data directory does not exist, let the user choose one */
Intro intro ;
Intro intro ;
@ -175,7 +178,7 @@ void Intro::pickDataDirectory()
}
}
dataDir = intro . getDataDirectory ( ) ;
dataDir = intro . getDataDirectory ( ) ;
try {
try {
fs : : create_directory ( dataDir . toStdString ( ) ) ;
fs : : create_directory ( GUIUtil : : qstringToBoostPath ( dataDir ) ) ;
break ;
break ;
} catch ( fs : : filesystem_error & e ) {
} catch ( fs : : filesystem_error & e ) {
QMessageBox : : critical ( 0 , tr ( " Bitcoin " ) ,
QMessageBox : : critical ( 0 , tr ( " Bitcoin " ) ,
@ -186,7 +189,12 @@ void Intro::pickDataDirectory()
settings . setValue ( " strDataDir " , dataDir ) ;
settings . setValue ( " strDataDir " , dataDir ) ;
}
}
SoftSetArg ( " -datadir " , dataDir . toStdString ( ) ) ;
/* Only override -datadir if different from the default, to make it possible to
* override - datadir in the bitcoin . conf file in the default data directory
* ( to be consistent with bitcoind behavior )
*/
if ( dataDir ! = getDefaultDataDirectory ( ) )
SoftSetArg ( " -datadir " , GUIUtil : : qstringToBoostPath ( dataDir ) . string ( ) ) ; // use OS locale for path setting
}
}
void Intro : : setStatus ( int status , const QString & message , quint64 bytesAvailable )
void Intro : : setStatus ( int status , const QString & message , quint64 bytesAvailable )