Show the actual correct config file name that cannot be found
This commit is contained in:
@@ -169,7 +169,7 @@ bool AppInit(int argc, char* argv[])
|
||||
{
|
||||
fprintf(stderr, "%s reading config file\n", __FUNCTION__);
|
||||
ReadConfigFile(mapArgs, mapMultiArgs);
|
||||
} catch (const missing_zcash_conf& e) {
|
||||
} catch (const missing_hush_conf& e) {
|
||||
fprintf(stderr,
|
||||
(_("Before starting hushd, you need to create a configuration file:\n"
|
||||
"%s\n"
|
||||
|
||||
@@ -16,15 +16,14 @@ def def_credentials(chain):
|
||||
rpcport = '';
|
||||
operating_system = platform.system()
|
||||
if operating_system == 'Darwin':
|
||||
ac_dir = os.environ['HOME'] + '/Library/Application Support/Komodo'
|
||||
ac_dir = os.environ['HOME'] + '/Library/Application Support/Hush'
|
||||
elif operating_system == 'Linux':
|
||||
ac_dir = os.environ['HOME'] + '/.komodo'
|
||||
ac_dir = os.environ['HOME'] + '/.hush'
|
||||
elif operating_system == 'Windows':
|
||||
ac_dir = '%s/komodo/' % os.environ['APPDATA']
|
||||
if chain == 'KMD':
|
||||
coin_config_file = str(ac_dir + '/komodo.conf')
|
||||
else:
|
||||
coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf')
|
||||
ac_dir = '%s/hush/' % os.environ['APPDATA']
|
||||
|
||||
coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf')
|
||||
|
||||
with open(coin_config_file, 'r') as f:
|
||||
for line in f:
|
||||
l = line.rstrip()
|
||||
@@ -35,8 +34,8 @@ def def_credentials(chain):
|
||||
elif re.search('rpcport', l):
|
||||
rpcport = l.replace('rpcport=', '')
|
||||
if len(rpcport) == 0:
|
||||
if chain == 'KMD':
|
||||
rpcport = 7771
|
||||
if chain == 'HUSH3':
|
||||
rpcport = 18031
|
||||
else:
|
||||
print("rpcport not in conf file, exiting")
|
||||
print("check " + coin_config_file)
|
||||
|
||||
@@ -722,14 +722,14 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
|
||||
{
|
||||
boost::filesystem::ifstream streamConfig(GetConfigFile());
|
||||
if (!streamConfig.good())
|
||||
throw missing_zcash_conf();
|
||||
throw missing_hush_conf();
|
||||
|
||||
set<string> setOptions;
|
||||
setOptions.insert("*");
|
||||
|
||||
for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
|
||||
{
|
||||
// Don't overwrite existing settings so command line settings override komodo.conf
|
||||
// Don't overwrite existing settings so command line settings override HUSH3.conf
|
||||
string strKey = string("-") + it->string_key;
|
||||
if (mapSettingsRet.count(strKey) == 0)
|
||||
{
|
||||
|
||||
@@ -145,9 +145,9 @@ boost::filesystem::path GetConfigFile();
|
||||
boost::filesystem::path GetPidFile();
|
||||
void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
|
||||
#endif
|
||||
class missing_zcash_conf : public std::runtime_error {
|
||||
class missing_hush_conf : public std::runtime_error {
|
||||
public:
|
||||
missing_zcash_conf() : std::runtime_error("Missing komodo.conf") { }
|
||||
missing_hush_conf() : std::runtime_error(strprintf("Missing %s",GetConfigFile().string() )) { }
|
||||
};
|
||||
void ReadConfigFile(std::map<std::string, std::string>& mapSettingsRet, std::map<std::string, std::vector<std::string> >& mapMultiSettingsRet);
|
||||
#ifdef _WIN32
|
||||
|
||||
Reference in New Issue
Block a user