mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Merge pull request #627 from jpnurmi/overwrite
Make --makeconf warn early about an existing config (#572)
This commit is contained in:
11
src/znc.cpp
11
src/znc.cpp
@@ -566,7 +566,14 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
|
||||
vsLines.push_back("Version = " + CString(VERSION, 1));
|
||||
|
||||
m_sConfigFile = ExpandConfigPath(sConfigFile);
|
||||
CUtils::PrintMessage("Building new config");
|
||||
|
||||
if (CFile::Exists(m_sConfigFile)) {
|
||||
CUtils::PrintStatus(false, "The config file [" + m_sConfigFile + "] already exists.");
|
||||
if (!CUtils::GetBoolInput("Would you like to overwrite it?", false))
|
||||
return false;
|
||||
} else {
|
||||
CUtils::PrintMessage("Building new config");
|
||||
}
|
||||
|
||||
CUtils::PrintMessage("");
|
||||
CUtils::PrintMessage("First let's start with some global settings...");
|
||||
@@ -917,7 +924,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
|
||||
} else {
|
||||
File.Close();
|
||||
CUtils::PrintStatus(false, "This config already exists.");
|
||||
if (CUtils::GetBoolInput("Would you like to overwrite it?", false))
|
||||
if (CUtils::GetBoolInput("Are you sure you want to overwrite it?", false))
|
||||
CUtils::PrintAction("Overwriting config [" + m_sConfigFile + "]");
|
||||
else
|
||||
bFileOK = false;
|
||||
|
||||
Reference in New Issue
Block a user