From 9af7c736d99e6292f0145cc9dfd6d7cee3e023d4 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 20 Jan 2022 00:12:50 +0800 Subject: [PATCH] cement: If console pauser doesn't exist, warn and stop running programs. --- NEWS.md | 1 + RedPandaIDE/compiler/compilermanager.cpp | 13 +++++++++++-- RedPandaIDE/compiler/executablerunner.cpp | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index f5e1aafd..4833f184 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,7 @@ Red Panda C++ Version 0.13.3 - fix: symbols defind locally should be sorted to the front in the code suggestion popup list - fix: when show function tips, can't correctly calcuate the current position in the function param list - fix: app will become very slow when processing very long lines. + - enhancement: If console pauser doesn't exist, warn and stop running programs. Red Panda C++ Version 0.13.2 - fix: "delete and exit" button in the environtment / folder option page doesn't work correctly diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 70c65357..14035398 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -248,16 +248,25 @@ void CompilerManager::run(const QString &filename, const QString &arguments, con #else QString newArguments; if (consoleFlag!=0) { + QString consolePauserPath=includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"consolepauser"; + if (!fileExists(consolePauserPath)) { + QMessageBox::critical(pMainWindow, + tr("Can't find Console Pauser"), + tr("Console Pauser \"%1\" doesn't exists!") + .arg(consolePauserPath)); + return; + + } if (redirectInput) { newArguments = QString(" -e \"%1\" %2 \"%3\" \"%4\" %5") - .arg(includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"consolepauser") + .arg(consolePauserPath) .arg(consoleFlag) .arg(redirectInputFilename) .arg(localizePath(filename)) .arg(arguments); } else { newArguments = QString(" -e \"%1\" %2 \"%3\" %4") - .arg(includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"consolepauser") + .arg(consolePauserPath) .arg(consoleFlag) .arg(localizePath(filename)).arg(arguments); } diff --git a/RedPandaIDE/compiler/executablerunner.cpp b/RedPandaIDE/compiler/executablerunner.cpp index cc47099b..5dabeadc 100644 --- a/RedPandaIDE/compiler/executablerunner.cpp +++ b/RedPandaIDE/compiler/executablerunner.cpp @@ -84,6 +84,7 @@ void ExecutableRunner::run() mProcess = std::make_shared(); mProcess->setProgram(mFilename); mProcess->setArguments(splitProcessCommand(mArguments)); + qDebug()<setWorkingDirectory(mWorkDir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path = env.value("PATH");