[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62463] uigetfile returns wrong path
From: |
Hg200 |
Subject: |
[Octave-bug-tracker] [bug #62463] uigetfile returns wrong path |
Date: |
Sat, 14 May 2022 17:04:02 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?62463>
Summary: uigetfile returns wrong path
Project: GNU Octave
Submitted by: hg200
Submitted on: Sat 14 May 2022 09:04:00 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: hg200
Originator Email:
Open/Closed: Open
Release: other
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Details:
To reproduce my problem, please start Octave and run the following command:
[filename,path] = uigetfile({'*.txt';'*.*'}, 'teststring');
Now, select a file from a *different* directory in the context menu. I.e. not
a file from the current directory you are working in. Result: The variable
"path" does not contain the directory path of the selected file, but the
original path of the working directory.
Affected is both the stable version [GNU Octave version: 7.1.1 (hg id:
ed06f74e16cf)] and the development branch. I can't say for sure, but I believe
this occurred with a new Linux installation (update to Fedora 35). I am using
qt5-qtbase-5.15.2-30.fc35.x86_64.
I did some checks:
./libgui/src/dialog.cc
void FileDialog::acceptSelection (void)
Around line 686 we have
if (testOption (QFileDialog::ShowDirsOnly) && string_result.size () > 0)
path = string_result[0];
else
path = directory ().absolutePath ();
With GDB I can see that the else path is executed because "testOption
(QFileDialog::ShowDirsOnly)" is false. When I check the variable "path", it
contains the wrong path. The correct path can be found in "string_result[0]".
However "string_result[0]" additionally seems to contain the filename. Since
the file_dialog is set up with the "dirname" variable, which contains the
current working directory, it seems logical to me that
"directory().absolutePath()" would return the working directory rather than
the directory where the selected file is located.
Can anyone reproduce the problem? Ideas, comments?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62463>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #62463] uigetfile returns wrong path,
Hg200 <=