refactor: Block unsafe fs::path std::string conversion calls

There is no change in behavior. This just helps prepare for the
transition from boost::filesystem to std::filesystem by avoiding calls
to methods which will be unsafe after the transaction to std::filesystem
to due lack of a boost::filesystem::path::imbue equivalent and inability
to set a predictable locale.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Co-authored-by: Kiminuo <kiminuo@protonmail.com>
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This commit is contained in:
committed 2021-10-05 11:10:47 -04:00
1 parent b39a477ec6
commit 6544ea5035
43 files changed
+244 -196

No files matched your search

+2 -2
View File
@@ -647,12 +647,12 @@ void setClipboard(const QString& str)
fs::path qstringToBoostPath(const QString &path)
{
return fs::path(path.toStdString());
return fs::u8path(path.toStdString());
}
QString boostPathToQString(const fs::path &path)
{
return QString::fromStdString(path.string());
return QString::fromStdString(path.u8string());
}
QString NetworkToQString(Network net)
+1 -1
View File
@@ -263,7 +263,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
* (to be consistent with bitcoind behavior)
*/
if(dataDir != GUIUtil::getDefaultDataDirectory()) {
gArgs.SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
gArgs.SoftSetArg("-datadir", fs::PathToString(GUIUtil::qstringToBoostPath(dataDir))); // use OS locale for path setting
}
return true;
}