From b326058ea2d77567a764fb4c5752e2796addea2d Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 6 Sep 2024 15:27:49 +0800 Subject: [PATCH] - fix: "bits/stdc++" is not openned in readonly mode. --- NEWS.md | 1 + RedPandaIDE/parser/cppparser.cpp | 6 +++--- RedPandaIDE/parser/parserutils.cpp | 5 +++-- RedPandaIDE/utils.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 65462927..6fc0edc1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ Red Panda C++ Version 3.2 - Change: The way to calcuate astyle path. - fix: Scroll bar arrow size not correct in the dark themes. - fix: Don't auto scroll to the caret after undo/redo. + - fix: "bits/stdc++" is not openned in readonly mode. Red Panda C++ Version 3.1 diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 66da1f92..c7dbadc5 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -107,7 +107,7 @@ void CppParser::addHardDefineByLine(const QString &line) void CppParser::addIncludePath(const QString &value) { QMutexLocker locker(&mMutex); - mPreprocessor.addIncludePath(includeTrailingPathDelimiter(value)); + mPreprocessor.addIncludePath(value); } void CppParser::removeProjectFile(const QString &value) @@ -121,7 +121,7 @@ void CppParser::removeProjectFile(const QString &value) void CppParser::addProjectIncludePath(const QString &value) { QMutexLocker locker(&mMutex); - mPreprocessor.addProjectIncludePath(includeTrailingPathDelimiter(value)); + mPreprocessor.addProjectIncludePath(value); } void CppParser::clearIncludePaths() @@ -897,7 +897,7 @@ QSet CppParser::internalGetFileUsings(const QString &filename) const QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &headerName, bool fromNext) const { QMutexLocker locker(&mMutex); - QString currentDir = includeTrailingPathDelimiter(extractFileDir(relativeTo)); + QString currentDir = extractFileDir(relativeTo); QStringList includes; QStringList projectIncludes; bool found=false; diff --git a/RedPandaIDE/parser/parserutils.cpp b/RedPandaIDE/parser/parserutils.cpp index ccc9f357..e76e065d 100644 --- a/RedPandaIDE/parser/parserutils.cpp +++ b/RedPandaIDE/parser/parserutils.cpp @@ -494,7 +494,8 @@ bool isSystemHeaderFile(const QString &fileName, const QSet &includePat bool isFullName = false; #ifdef Q_OS_WIN - isFullName = fileName.startsWith("/") || (fileName.length()>2 && fileName[1]==':'); + isFullName = fileName.startsWith("/") || (fileName.length()>2 && fileName[1]==':' + && fileName[0].isLetter()); #else isFullName = fileName.startsWith("/"); #endif @@ -503,7 +504,7 @@ bool isSystemHeaderFile(const QString &fileName, const QSet &includePat // If it's a full file name, check if its directory is an include path if (info.exists()) { // full file name QDir dir = info.dir(); - QString absPath = includeTrailingPathDelimiter(dir.absolutePath()); + QString absPath = dir.absolutePath(); foreach (const QString& incPath, includePaths) { if (absPath.startsWith(incPath)) return true; diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 9fe3dadd..2dd692ca 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -562,7 +562,7 @@ void openFileFolderInExplorer(const QString &path) #ifdef Q_OS_WIN QProcess process; QStringList args; - QString filepath=info.absoluteFilePath().replace("/","\\"); + QString filepath=QDir::toNativeSeparators(info.absoluteFilePath()); args.append("/n,"); args.append("/select,"); args.append(QString("%1").arg(filepath));