- fix: Confirm if recompile, when start to debug and project files has modifications.

This commit is contained in:
Roy Qu 2023-02-11 11:31:54 +08:00
parent 7b52eff40d
commit ff86213aee
2 changed files with 21 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Red Panda C++ Version 2.12
- fix: Crash when create or open txt files in project. - fix: Crash when create or open txt files in project.
- enhancement: Code folding for #if/#endif - enhancement: Code folding for #if/#endif
- enhancement: When folding "if", don't fold "else"; - enhancement: When folding "if", don't fold "else";
- fix: Confirm if recompile, when start to debug and project files has modifications.
Red Panda C++ Version 2.11 Red Panda C++ Version 2.11

View File

@ -2131,6 +2131,7 @@ void MainWindow::debug()
} }
return; return;
} }
// Did we compile? // Did we compile?
if (!fileExists(mProject->executable())) { if (!fileExists(mProject->executable())) {
if (QMessageBox::question( if (QMessageBox::question(
@ -2162,6 +2163,25 @@ void MainWindow::debug()
compile(); compile();
return; return;
} }
{
QFileInfo execInfo(mProject->executable());
QDateTime execModTime = execInfo.lastModified();
if (execInfo.exists() && mProject->unitsModifiedSince(execModTime) &&
QMessageBox::question(
this,
tr("Rebuild Project"),
tr("Project has been modified, do you want to rebuild it?")
) == QMessageBox::Yes) {
//mProject->saveAll();
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug;
mCompileSuccessionTask->execName=mProject->executable();
mCompileSuccessionTask->isExecutable=true;
mCompileSuccessionTask->binDirs=binDirs;
compile();
return;
}
}
// Did we choose a host application for our DLL? // Did we choose a host application for our DLL?
if (mProject->options().type == ProjectType::DynamicLib) { if (mProject->options().type == ProjectType::DynamicLib) {
if (mProject->options().hostApplication.isEmpty()) { if (mProject->options().hostApplication.isEmpty()) {