Open scripts.inc when scripts.pory doesn't exist

This commit is contained in:
GriffinR 2020-06-14 23:10:08 -04:00 committed by huderlem
parent a9bd7b884d
commit ee7978ea2d

View file

@ -1213,8 +1213,12 @@ void MainWindow::redo() {
// Open current map scripts in system default editor for .inc files // Open current map scripts in system default editor for .inc files
void MainWindow::openInTextEditor() { void MainWindow::openInTextEditor() {
QString path = QDir::cleanPath("file://" + editor->project->root + QDir::separator() + "data/maps/" + editor->map->name + "/scripts" + editor->project->getScriptFileExtension(projectConfig.getUsePoryScript())); bool usePoryscript = projectConfig.getUsePoryScript();
QDesktopServices::openUrl(QUrl(path)); 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() { void MainWindow::on_action_Save_triggered() {