From ee7978ea2d5c64f6169748dd20e86569c6273da1 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 14 Jun 2020 23:10:08 -0400 Subject: [PATCH] Open scripts.inc when scripts.pory doesn't exist --- src/mainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 61125117..6d3ae075 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1213,8 +1213,12 @@ void MainWindow::redo() { // Open current map scripts in system default editor for .inc files void MainWindow::openInTextEditor() { - QString path = QDir::cleanPath("file://" + editor->project->root + QDir::separator() + "data/maps/" + editor->map->name + "/scripts" + editor->project->getScriptFileExtension(projectConfig.getUsePoryScript())); - QDesktopServices::openUrl(QUrl(path)); + bool usePoryscript = projectConfig.getUsePoryScript(); + QString path = QDir::cleanPath("file://" + editor->project->root + QDir::separator() + "data/maps/" + editor->map->name + "/scripts"); + + // Try opening scripts file, if opening .pory failed try again with .inc + if (!QDesktopServices::openUrl(QUrl(path + editor->project->getScriptFileExtension(usePoryscript))) && usePoryscript) + QDesktopServices::openUrl(QUrl(path + editor->project->getScriptFileExtension(false))); } void MainWindow::on_action_Save_triggered() {