aboutsummaryrefslogtreecommitdiff
path: root/src/qt/intro.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-03-22 10:22:42 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-03-25 09:20:10 +0100
commit7e591c19e70a151390eb2c0f83c3836178b76ee6 (patch)
treeb87e0b157f77e829de24d90b6461381f7cf67581 /src/qt/intro.cpp
parente3f5d4338d0305a398817279e36ef2d0cfd2fd2b (diff)
qt: Do proper boost::path conversion
Convert from QString unicode from/to the OS-dependent locale as used by boost::filesystem::path as needed. Solves #3916.
Diffstat (limited to 'src/qt/intro.cpp')
-rw-r--r--src/qt/intro.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 3bc19f8645..26efc4a788 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -5,9 +5,12 @@
#include "intro.h"
#include "ui_intro.h"
+#include "guiutil.h"
+
#include "util.h"
#include <boost/filesystem.hpp>
+
#include <QFileDialog>
#include <QSettings>
#include <QMessageBox>
@@ -59,7 +62,7 @@ void FreespaceChecker::check()
{
namespace fs = boost::filesystem;
QString dataDirStr = intro->getPathToCheck();
- fs::path dataDir = fs::path(dataDirStr.toStdString());
+ fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr);
uint64_t freeBytesAvailable = 0;
int replyStatus = ST_OK;
QString replyMessage = tr("A new data directory will be created.");
@@ -143,7 +146,7 @@ void Intro::setDataDirectory(const QString &dataDir)
QString Intro::getDefaultDataDirectory()
{
- return QString::fromStdString(GetDefaultDataDir().string());
+ return GUIUtil::boostPathToQString(GetDefaultDataDir());
}
void Intro::pickDataDirectory()
@@ -159,7 +162,7 @@ void Intro::pickDataDirectory()
/* 2) Allow QSettings to override default dir */
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 */
Intro intro;
@@ -175,7 +178,7 @@ void Intro::pickDataDirectory()
}
dataDir = intro.getDataDirectory();
try {
- fs::create_directory(dataDir.toStdString());
+ fs::create_directory(GUIUtil::qstringToBoostPath(dataDir));
break;
} catch(fs::filesystem_error &e) {
QMessageBox::critical(0, tr("Bitcoin"),
@@ -186,7 +189,7 @@ void Intro::pickDataDirectory()
settings.setValue("strDataDir", dataDir);
}
- SoftSetArg("-datadir", dataDir.toStdString());
+ SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
}
void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)