Closed yan12125 closed 3 years ago
Confirming. pcmanfm-qt "foo bar"
works but qtxdg-mat open "foo bar"
gives the above-mentioned error, here too.
xdg-open "foo bar"
works fine too. So, libqtxdg
needs a fix.
Probably I'm doing something wrong
[lpereira@manjaro ~]$ xdg-open "Desktop Documents"
xdg-open: file 'Desktop Documents' does not exist
and
pcmanfm-qt "Desktop Documents"
get me this:
@luis-pereira
In @yan12125's example, the folder "foo bar" exists but qtxdg-mat
can't open it.
@tsujan Thanks!. I didn't read the mkdir .....
.
I was right.... I was doing something wrong. ;)
I'm not sure what should be the fix. Adding file: when needed? Just don't call .toEncoded() and hope applications always encode URLs?
We can't rely on others good behavior. Some tweak in checking if the file is local and some minor changes should do it. Implementing it tomorrow.
@yan12125 Can you pls take a look at the draft PR at https://github.com/lxqt/libqtxdg/pull/232 ?
Expected Behavior
Running the following commands from the terminal (QTerminal in my case) should open the directory
foo bar
in pcmanfm-qt (my default file manager)Current Behavior
A dialog with error message
Possible Solution
This is how everything goes:
pcmanfm-qt.desktop
hasExec=pcmanfm-qt %U
XdgDesktopFile::expandExecString()
create aQUrl
from/home/yen/tmp/foo bar
for%U
[1]url.toEncoded()
is called and the result is a non-existent path. This happens astoLocalFile()
returns an empty string for URLs withoutfile:
scheme. [2]I'm not sure what should be the fix. Adding
file:
when needed? Just don't call.toEncoded()
and hope applications always encode URLs?[1] https://github.com/lxqt/libqtxdg/blob/0133926cfed4f2f1c1e407b3592786db6cf85ed1/src/qtxdg/xdgdesktopfile.cpp#L1133-L1134 [2] https://doc.qt.io/qt-5/qurl.html
Steps to Reproduce (for bugs)
(See above)
Context
Noticed this bug when I tried to switch from
alias open=xdg-open
toalias open="qtxdg-mat open"
System Information