changeset 25773:e222da9beaac

fix prompt when editing a new m-file wit absolute path (bug #54463) * octave-qt-link.cc (do_prompt_new_edit_file): make absolute path from given path/file string instead of appending the string to the current directory
author Torsten <mttl@mailbox.org>
date Sat, 11 Aug 2018 21:51:49 +0200
parents 5eeecebcd91a
children f5ea7511c405
files libgui/src/octave-qt-link.cc
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-qt-link.cc	Sat Aug 11 15:26:45 2018 -0400
+++ b/libgui/src/octave-qt-link.cc	Sat Aug 11 21:51:49 2018 +0200
@@ -100,7 +100,8 @@
     if (! settings || settings->value ("editor/create_new_file",false).toBool ())
       return true;
 
-    QFileInfo file_info (QString::fromStdString (file));
+    std::string abs_fname = octave::sys::env::make_absolute (file);
+
     QStringList btn;
     QStringList role;
     role << "YesRole" << "RejectRole";
@@ -111,8 +112,7 @@
 
     uiwidget_creator.signal_dialog (
                                     tr ("File\n%1\ndoes not exist. Do you want to create it?").
-                                    arg (QDir::currentPath () + QDir::separator ()
-                                         + QString::fromStdString (file)),
+                                    arg (QString::fromStdString (abs_fname)),
                                     tr ("Octave Editor"), "quest", btn, tr ("Create"), role);
 
     // Wait while the user is responding to message box.