aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/util.cpp b/src/util.cpp
index f1af91de27..88d70cd38f 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -908,15 +908,28 @@ string GetConfigFile()
return pathConfig.string();
}
-void ReadConfigFile(map<string, string>& mapSettingsRet,
+bool ReadConfigFile(map<string, string>& mapSettingsRet,
map<string, vector<string> >& mapMultiSettingsRet)
{
namespace fs = boost::filesystem;
namespace pod = boost::program_options::detail;
+ if (mapSettingsRet.count("-datadir"))
+ {
+ if (fs::is_directory(fs::system_complete(mapSettingsRet["-datadir"])))
+ {
+ fs::path pathDataDir = fs::system_complete(mapSettingsRet["-datadir"]);
+ strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
fs::ifstream streamConfig(GetConfigFile());
if (!streamConfig.good())
- return;
+ return true; // No bitcoin.conf file is OK
set<string> setOptions;
setOptions.insert("*");
@@ -933,6 +946,7 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
}
mapMultiSettingsRet[strKey].push_back(it->value[0]);
}
+ return true;
}
string GetPidFile()