@@ -111,8 +111,10 @@ int main(int argc, char* argv[])
111111 exit (-1 );
112112 }
113113
114+ bool PathAlreadyExisted = true ;
114115 std::string TargetPath = arg_result[" folder" ].as <std::string>();
115116 TargetPath = Common::rtrim (TargetPath, " \\ " );
117+ bool SqlMasterHeader_AlreadyExisted = sqlite3pp::file_exists (TargetPath + " \\ sql_Master_Header.h" );
116118 if (TargetPath.size ())
117119 {
118120 V_COUT (DETAIL, " Using destination path '" << TargetPath << " '." );
@@ -129,17 +131,18 @@ int main(int argc, char* argv[])
129131 {
130132 V_COUT (INFO, " Creating target path '" << TargetPath << " '." );
131133 _mkdir (TargetPath.c_str ());
134+ PathAlreadyExisted = false ;
132135 }
133136 }
134137
135138 std::string FileExt = arg_result[" fileext" ].as <std::string>().size () ? arg_result[" fileext" ].as <std::string>() : " h" ;
136139 V_COUT (DETAIL, " Files created will use file extension '" << FileExt << " '." );
137140
138- if (!arg_result[" dhead" ].as <bool >())
141+ if (!arg_result[" dhead" ].as <bool >() && PathAlreadyExisted && SqlMasterHeader_AlreadyExisted )
139142 {
140- V_COUT (INFO, " Deleting exsiting headers." );
143+ V_COUT (INFO, " Deleting existing headers." );
141144 std::string Command = " del /F /Q " + TargetPath + " \\ " + arg_result[" prefix" ].as <std::string>() + " *" + arg_result[" postfix" ].as <std::string>() + " ." + FileExt;
142- V_COUT (DEBUG, " Deleting exsiting headers. by using command:" << Command);
145+ V_COUT (DEBUG, " Deleting existing headers. by using command:" << Command);
143146 system (Command.c_str ()); // ToDo: Create a cleaner method for this.
144147 }
145148
0 commit comments