- fix: "bits/stdc++" is not openned in readonly mode.

This commit is contained in:
Roy Qu 2024-09-06 15:27:49 +08:00
parent 20cb728306
commit b326058ea2
4 changed files with 8 additions and 6 deletions

View File

@ -3,6 +3,7 @@ Red Panda C++ Version 3.2
- Change: The way to calcuate astyle path. - Change: The way to calcuate astyle path.
- fix: Scroll bar arrow size not correct in the dark themes. - fix: Scroll bar arrow size not correct in the dark themes.
- fix: Don't auto scroll to the caret after undo/redo. - 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 Red Panda C++ Version 3.1

View File

@ -107,7 +107,7 @@ void CppParser::addHardDefineByLine(const QString &line)
void CppParser::addIncludePath(const QString &value) void CppParser::addIncludePath(const QString &value)
{ {
QMutexLocker locker(&mMutex); QMutexLocker locker(&mMutex);
mPreprocessor.addIncludePath(includeTrailingPathDelimiter(value)); mPreprocessor.addIncludePath(value);
} }
void CppParser::removeProjectFile(const QString &value) void CppParser::removeProjectFile(const QString &value)
@ -121,7 +121,7 @@ void CppParser::removeProjectFile(const QString &value)
void CppParser::addProjectIncludePath(const QString &value) void CppParser::addProjectIncludePath(const QString &value)
{ {
QMutexLocker locker(&mMutex); QMutexLocker locker(&mMutex);
mPreprocessor.addProjectIncludePath(includeTrailingPathDelimiter(value)); mPreprocessor.addProjectIncludePath(value);
} }
void CppParser::clearIncludePaths() void CppParser::clearIncludePaths()
@ -897,7 +897,7 @@ QSet<QString> CppParser::internalGetFileUsings(const QString &filename) const
QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &headerName, bool fromNext) const QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &headerName, bool fromNext) const
{ {
QMutexLocker locker(&mMutex); QMutexLocker locker(&mMutex);
QString currentDir = includeTrailingPathDelimiter(extractFileDir(relativeTo)); QString currentDir = extractFileDir(relativeTo);
QStringList includes; QStringList includes;
QStringList projectIncludes; QStringList projectIncludes;
bool found=false; bool found=false;

View File

@ -494,7 +494,8 @@ bool isSystemHeaderFile(const QString &fileName, const QSet<QString> &includePat
bool isFullName = false; bool isFullName = false;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
isFullName = fileName.startsWith("/") || (fileName.length()>2 && fileName[1]==':'); isFullName = fileName.startsWith("/") || (fileName.length()>2 && fileName[1]==':'
&& fileName[0].isLetter());
#else #else
isFullName = fileName.startsWith("/"); isFullName = fileName.startsWith("/");
#endif #endif
@ -503,7 +504,7 @@ bool isSystemHeaderFile(const QString &fileName, const QSet<QString> &includePat
// If it's a full file name, check if its directory is an include path // If it's a full file name, check if its directory is an include path
if (info.exists()) { // full file name if (info.exists()) { // full file name
QDir dir = info.dir(); QDir dir = info.dir();
QString absPath = includeTrailingPathDelimiter(dir.absolutePath()); QString absPath = dir.absolutePath();
foreach (const QString& incPath, includePaths) { foreach (const QString& incPath, includePaths) {
if (absPath.startsWith(incPath)) if (absPath.startsWith(incPath))
return true; return true;

View File

@ -562,7 +562,7 @@ void openFileFolderInExplorer(const QString &path)
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QProcess process; QProcess process;
QStringList args; QStringList args;
QString filepath=info.absoluteFilePath().replace("/","\\"); QString filepath=QDir::toNativeSeparators(info.absoluteFilePath());
args.append("/n,"); args.append("/n,");
args.append("/select,"); args.append("/select,");
args.append(QString("%1").arg(filepath)); args.append(QString("%1").arg(filepath));