diff --git a/NEWS.md b/NEWS.md index 68586972..c997ca1c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ Red Panda C++ Version 2.12 - fix: Crash when create or open txt files in project. - enhancement: Code folding for #if/#endif - 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 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 93949442..39cd6411 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2131,6 +2131,7 @@ void MainWindow::debug() } return; } + // Did we compile? if (!fileExists(mProject->executable())) { if (QMessageBox::question( @@ -2162,6 +2163,25 @@ void MainWindow::debug() compile(); 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(); + 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? if (mProject->options().type == ProjectType::DynamicLib) { if (mProject->options().hostApplication.isEmpty()) {