Skip to content

Commit

Permalink
Fix pathing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
blondfrogs committed Jan 22, 2024
1 parent ec29828 commit 9995c92
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,16 +693,31 @@ boost::filesystem::path GetConfigFile()

boost::filesystem::path GetFluxnodeConfigFile()
{
boost::filesystem::path pathConfigFile(GetArg("-znconf", "zelnode.conf"));
if (!pathConfigFile.is_complete()) {
pathConfigFile = GetDataDir() / pathConfigFile;
return pathConfigFile;
namespace fs = boost::filesystem;

// If zelnode.conf exists use this file instead of fluxnode.conf
boost::filesystem::path pathZelnodeConfigFile(GetArg("-znconf", "zelnode.conf"));
if (!pathZelnodeConfigFile.is_complete()) {
pathZelnodeConfigFile = GetDataDir() / pathZelnodeConfigFile;
if (fs::exists(pathZelnodeConfigFile)) {
LogPrintf("Using zelnode.conf Config File\n");
return pathZelnodeConfigFile;
}
}

// Use fluxnode.conf as the next option
boost::filesystem::path pathFluxnodeConfigFile(GetArg("-znconf", "fluxnode.conf"));
if (!pathFluxnodeConfigFile.is_complete()) {
pathFluxnodeConfigFile = GetDataDir() / pathFluxnodeConfigFile;
if (fs::exists(pathFluxnodeConfigFile)) {
LogPrintf("Using fluxnode.conf Config File\n");
return pathFluxnodeConfigFile;
}
}

boost::filesystem::path pathConfigFile(GetArg("-znconf", "fluxnode.conf"));
if (!pathConfigFile.is_complete())
pathConfigFile = GetDataDir() / pathConfigFile;
return pathConfigFile;
// If no file exists yet. It needs to be created. Returning the location and filename so it can be created
// Newly created files should be in the format of fluxnode.conf
return pathFluxnodeConfigFile;
}

void ReadConfigFile(map<string, string>& mapSettingsRet,
Expand Down

0 comments on commit 9995c92

Please sign in to comment.