bool SoftSetArg(const std::string& strArg, const std::string& strValue)
{
- if (mapArgs.count(strArg))
+ if (mapArgs.count(strArg) || mapMultiArgs.count(strArg))
return false;
mapArgs[strArg] = strValue;
+ mapMultiArgs[strArg].push_back(strValue);
+
return true;
}
return path;
}
+string randomStrGen(int length) {
+ static string charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+ string result;
+ result.resize(length);
+ for (int32_t i = 0; i < length; i++)
+ result[i] = charset[rand() % charset.length()];
+
+ return result;
+}
+
+void createConf()
+{
+ srand(time(NULL));
+
+ ofstream pConf;
+ pConf.open(GetConfigFile().generic_string().c_str());
+ pConf << "rpcuser=user\nrpcpassword="
+ + randomStrGen(15)
+ + "\nrpcport=8344"
+ + "\nport=7777"
+ + "\ndaemon=0 #(0=off, 1=on) Run in the background as a daemon and accept commands"
+ + "\nserver=0 #(0=off, 1=on) Accept command line and JSON-RPC commands"
+ + "\nrpcallowip=127.0.0.1"
+ + "\ntestnet=0";
+ pConf.close();
+}
+
boost::filesystem::path GetConfigFile()
{
boost::filesystem::path pathConfigFile(GetArg("-conf", "novacoin.conf"));
{
boost::filesystem::ifstream streamConfig(GetConfigFile());
if (!streamConfig.good())
- return; // No bitcoin.conf file is OK
+ {
+ createConf();
+ new(&streamConfig) boost::filesystem::ifstream(GetConfigFile());
+ if(!streamConfig.good())
+ return;
+ }
set<string> setOptions;
setOptions.insert("*");