Skip to content

Commit f1a9db5

Browse files
Update SQLiteClassBuilder.cpp
1 parent 2fe3af6 commit f1a9db5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

SQLiteClassBuilder.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)