Skip to content
Browse files

Make --makeconf warn early about an existing config (#572)

  • Loading branch information...
1 parent f2f3edb commit fb0dcc0dd92ee099459d1a242f3c10e8b796cb81 @jpnurmi jpnurmi committed Aug 11, 2014
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;

0 comments on commit fb0dcc0

Please sign in to comment.
Something went wrong with that request. Please try again.