forked from townforge/townforge
game: fix dameon log location for testnet and mainnet
This commit is contained in:
parent
5ef691fcad
commit
28140be2af
@ -29,10 +29,17 @@ extern "C" char **environ;
|
||||
|
||||
#define DAEMON_WAIT_TIME 10 // seconds
|
||||
|
||||
static std::vector<std::string> get_last_errors(std::string data_dir)
|
||||
static std::vector<std::string> get_last_errors(std::string data_dir, cryptonote::network_type nettype)
|
||||
{
|
||||
if (data_dir.empty())
|
||||
data_dir = daemonizer::get_default_data_dir().string();
|
||||
std::string log_dir = data_dir;
|
||||
switch (nettype)
|
||||
{
|
||||
case cryptonote::TESTNET: data_dir += "/testnet"; break;
|
||||
case cryptonote::STAGENET: data_dir += "/stagenet"; break;
|
||||
default: break;
|
||||
}
|
||||
const std::string log_filename = data_dir + "/townforge.log";
|
||||
if (!epee::file_io_utils::is_file_exist(log_filename))
|
||||
return {"Failed to find daemon log"};
|
||||
@ -256,7 +263,7 @@ std::vector<std::string> DaemonController::Start()
|
||||
if (t - t0 > DAEMON_WAIT_TIME)
|
||||
{
|
||||
MERROR("Failed to connect to daemon, cannot start");
|
||||
std::vector<std::string> errors = get_last_errors(data_dir);
|
||||
std::vector<std::string> errors = get_last_errors(data_dir, nettype);
|
||||
if (errors.empty())
|
||||
errors.push_back("Failed to connect to daemon, cannot start");
|
||||
return errors;
|
||||
|
Loading…
Reference in New Issue
Block a user