-Saving controller file now prompts user on overwrite

This commit is contained in:
Harry van Haaren 2013-11-14 16:50:24 +00:00
parent 5bf93ac39a
commit ff462b06fe

View file

@ -219,9 +219,16 @@ int DiskWriter::writeControllerFile(std::string name ,
{
// file exists: ask user overwrite or rename?
LUPPP_WARN("Controller filename exists: prompting user to overwrite y/n?");
controllerCfgPath << ".newCtlr";
int overwrite = fl_choice("Controller filename exists, overwrite?", "no", "yes", 0);
if ( !overwrite )
{
// return OK, as user has chosen to *not* write the file
return LUPPP_RETURN_OK;
}
}
LUPPP_NOTE("Writing .ctlr file to disk");
ofstream controllerCfgFile;
controllerCfgFile.open ( controllerCfgPath.str().c_str() );
controllerCfgFile << cJSON_Print( controllerJson );