Commit 04af80f2 authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Fix bug with relative paths provided on command line

The list of open files in the window is a list of absolute paths so
the new path needs to be made absolute before checking if it is open.
Refs #15682
parent 9ed3a728
......@@ -769,8 +769,11 @@ bool ScriptingWindow::shouldEnableAbort() const {
* active tab will be the one containing the given script.
* @param filename The name of the newTab to open
void ScriptingWindow::openUnique(const QString &filename) {
void ScriptingWindow::openUnique(QString filename) {
auto openFiles = m_manager->fileNamesToQStringList();
// The list of open files contains absolute paths so make sure we have one
// here
filename = QFileInfo(filename).absFilePath();
auto position = openFiles.indexOf(filename);
if (position < 0) {
m_manager->newTab(openFiles.size(), filename);
......@@ -56,7 +56,7 @@ public:
/// Set whether to accept/reject close events
void acceptCloseEvent(const bool value);
/// Opens a script providing a copy is not already open
void openUnique(const QString &filename);
void openUnique(QString filename);
/// Show the scripting language dialog
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment