File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -735,18 +735,17 @@ fs::path GetConfigFile(const std::string& confPath)
735
735
return AbsPathForConfigVal (fs::path (confPath), false );
736
736
}
737
737
738
- void ArgsManager::ReadConfigFile ( const std::string& confPath )
738
+ void ArgsManager::ReadConfigStream ( std::istream& stream )
739
739
{
740
- fs::ifstream streamConfig (GetConfigFile (confPath));
741
- if (!streamConfig.good ())
740
+ if (!stream.good ())
742
741
return ; // No bitcoin.conf file is OK
743
742
744
743
{
745
744
LOCK (cs_args);
746
745
std::set<std::string> setOptions;
747
746
setOptions.insert (" *" );
748
747
749
- for (boost::program_options::detail::config_file_iterator it (streamConfig , setOptions), end; it != end; ++it)
748
+ for (boost::program_options::detail::config_file_iterator it (stream , setOptions), end; it != end; ++it)
750
749
{
751
750
// Don't overwrite existing settings so command line settings override bitcoin.conf
752
751
std::string strKey = std::string (" -" ) + it->string_key ;
@@ -757,6 +756,13 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
757
756
mapMultiArgs[strKey].push_back (strValue);
758
757
}
759
758
}
759
+ }
760
+
761
+ void ArgsManager::ReadConfigFile (const std::string& confPath)
762
+ {
763
+ fs::ifstream stream (GetConfigFile (confPath));
764
+ ReadConfigStream (stream);
765
+
760
766
// If datadir is changed in .conf file:
761
767
ClearDatadirCache ();
762
768
if (!fs::is_directory (GetDataDir (false ))) {
Original file line number Diff line number Diff line change @@ -228,6 +228,8 @@ class ArgsManager
228
228
std::map<std::string, std::vector<std::string>> mapMultiArgs;
229
229
std::unordered_set<std::string> m_negated_args;
230
230
231
+ void ReadConfigStream (std::istream& stream);
232
+
231
233
public:
232
234
void ParseParameters (int argc, const char *const argv[]);
233
235
void ReadConfigFile (const std::string& confPath);
You can’t perform that action at this time.
0 commit comments