diff --git a/NEWS.md b/NEWS.md index 65017fd4..42c4afd4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ Red Panda C++ Version 2.23 - enhancement: Tooltip support for '->' operator on std iterators. - enhancement: Close other editors. - fix: Goto definition/Goto declaration/Info tips can't be correctly triggered when mouse pointer is at the last half character of current word. + - fix: Use "/" as path seperator when starting app by double clicking c/c++ files in the explorer. Red Panda C++ Version 2.22 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 2152ba86..850d3c52 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1453,10 +1453,15 @@ void MainWindow::openFiles(const QStringList &files) e->activate(); } -Editor* MainWindow::openFile(const QString &filename, bool activate, QTabWidget* page) +Editor* MainWindow::openFile(QString filename, bool activate, QTabWidget* page) { if (!fileExists(filename)) return nullptr; + + QFileInfo info=QFileInfo(filename); + if (info.isAbsolute()) + filename = info.absoluteFilePath(); + Editor* editor = mEditorList->getOpenedEditorByFilename(filename); if (editor!=nullptr) { if (activate) { @@ -1501,11 +1506,14 @@ Editor* MainWindow::openFile(const QString &filename, bool activate, QTabWidget* return nullptr; } -void MainWindow::openProject(const QString &filename, bool openFiles) +void MainWindow::openProject(QString filename, bool openFiles) { if (!fileExists(filename)) { return; } + QFileInfo info=QFileInfo(filename); + if (info.isAbsolute()) + filename = info.absoluteFilePath(); Editor* oldEditor=nullptr; if (mProject) { if (mProject->filename() == filename) diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 1a0326cf..3421401a 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -221,8 +221,8 @@ public: TodoModel* todoModel(); - Editor* openFile(const QString& filename, bool activate=true, QTabWidget* page=nullptr); - void openProject(const QString& filename, bool openFiles = true); + Editor* openFile(QString filename, bool activate=true, QTabWidget* page=nullptr); + void openProject(QString filename, bool openFiles = true); void changeOptions(const QString& widgetName=QString(), const QString& groupName=QString()); void changeProjectOptions(const QString& widgetName=QString(), const QString& groupName=QString());