- fix: crash if compiler set's include dir list is not empty and lib dir list is empry

This commit is contained in:
Roy Qu 2022-01-24 16:45:43 +08:00
parent 3c132d69f3
commit 05e7d42447
3 changed files with 14 additions and 8 deletions

View File

@ -21,6 +21,7 @@ Red Panda C++ Version 0.13.3
- fix: when open a file, all blank lines's indents are removed.
- fix: indent lines displayed at wrong position, when there are folded lines
- fix: if editor's active line color is disabled, caret's position may not be correct redrawn
- fix: crash if compiler set's include dir list is not empty and lib dir list is empry
Red Panda C++ Version 0.13.2
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly

View File

@ -1591,22 +1591,22 @@ bool Settings::CompilerSet::validateExes(QString &msg)
msg ="";
if (!fileExists(mCCompiler)) {
msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("C Compiler")
.arg(QObject::tr("C Compiler"))
.arg(mCCompiler);
}
if (!fileExists(mCppCompiler)) {
msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("C++ Compiler")
.arg(QObject::tr("C++ Compiler"))
.arg(mCppCompiler);
}
if (!fileExists(mMake)) {
if (!mMake.isEmpty() && !fileExists(mMake)) {
msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("Maker")
.arg(QObject::tr("Maker"))
.arg(mMake);
}
if (!fileExists(mDebugger)) {
msg += QObject::tr("Cannot find the %1 \"%2\"")
.arg("Maker")
.arg(QObject::tr("Debugger"))
.arg(mDebugger);
}
if (!msg.isEmpty())
@ -2533,22 +2533,27 @@ void Settings::CompilerSets::clearSets()
void Settings::CompilerSets::findSets()
{
clearSets();
QSet<QString> searched;
#ifdef Q_OS_WIN
addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin");
addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+QDir::separator()+"bin");
searched.insert(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin");
searched.insert(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+QDir::separator()+"bin");
#endif
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString path = env.value("PATH");
QStringList pathList = path.split(PATH_SEPARATOR);
QSet<QString> searched;
foreach (const QString& s, pathList){
if (searched.contains(s))
continue;;
searched.insert(s);
if (s!="/bin") // /bin/gcc is symbolic link to /usr/bin/gcc
if (s!="/bin") { // /bin/gcc is symbolic link to /usr/bin/gcc
addSets(s);
}
}
}
void Settings::CompilerSets::saveSets()

View File

@ -825,7 +825,7 @@ QString parseMacros(const QString &s)
// Only provide the first lib dir
if (compilerSet->defaultLibDirs().count()>0)
result.replace("<LIB>", localizePath(compilerSet->defaultCppIncludeDirs().front()));
result.replace("<LIB>", localizePath(compilerSet->defaultLibDirs().front()));
else
result.replace("<LIB>","");
}