Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #627 from jpnurmi/overwrite

Make --makeconf warn early about an existing config (#572)
  • Loading branch information...
commit 3db0c0bc40bd4e10f4bcd9ffaf6dd172c732534f 2 parents f464066 + fb0dcc0
@DarthGandalf DarthGandalf authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/znc.cpp
View
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;
Please sign in to comment.
Something went wrong with that request. Please try again.