Home path is translated into /run/user/1000
-
I have snapped a Qt application, when the user wants to open a file I use the QFileDialog::getOpenFileName.
The path returned is /run/user/1000/doc/39face4d/myFile.txt instead of /home/user/Documents/myFile.txtHow do I get the “User friendly” path? Is there any configuration I'm missing?
-
I have snapped a Qt application, when the user wants to open a file I use the QFileDialog::getOpenFileName.
The path returned is /run/user/1000/doc/39face4d/myFile.txt instead of /home/user/Documents/myFile.txtHow do I get the “User friendly” path? Is there any configuration I'm missing?
@JoZCaVaLLo
/run/user/...
is taken from yourXDG_RUNTIME_DIR
environment variable. It's intended to be just a safe, temporary area you can write to.I don't think there is any relationship between the path you mention and the user's actual home directory (e.g. no soft link). So why is the end user choosing to store stuff there from your
QFileDialog::getOpenFileName
? If you are saying that it starts out from/run/user/1000/doc/39face4d
instead of/home/user/Documents
or similar, and that is why the user saves there, then please say so? -
I have snapped a Qt application, when the user wants to open a file I use the QFileDialog::getOpenFileName.
The path returned is /run/user/1000/doc/39face4d/myFile.txt instead of /home/user/Documents/myFile.txtHow do I get the “User friendly” path? Is there any configuration I'm missing?
@JoZCaVaLLo
How do you save that file? Does it exist in your directory before or did you create it on runtime? In the second case, I would think about the way, how (and especially where!) the file is saved.
To make sure, that it's the same directory on every system, you can use this:
https://doc.qt.io/qt-5/qstandardpaths.html#StandardLocation-enum -
Thank you all for answering...
The problem is much more snap related... but maybe someone on this forum already found a solution:QString fileName = QFileDialog::getOpenFileName( this, QString(), "~", "*.*");
This opens the Choose File Dialog...
I select the file /home/user/Documents/myFile.txt (already exists).The value of fileName is "/run/user/1000/doc/6cdffe5/myFile.txt"
instead of "/home/user/Documents/myFile.txt" -
Thank you all for answering...
The problem is much more snap related... but maybe someone on this forum already found a solution:QString fileName = QFileDialog::getOpenFileName( this, QString(), "~", "*.*");
This opens the Choose File Dialog...
I select the file /home/user/Documents/myFile.txt (already exists).The value of fileName is "/run/user/1000/doc/6cdffe5/myFile.txt"
instead of "/home/user/Documents/myFile.txt"@JoZCaVaLLo said in Home path is translated into /run/user/1000:
OK, so with that"~"
(I would not have used that) it deffo opens correctly in/home/user
? Then you browse down from there intoDocuments
and pick something there? Yet it returns a path in/run/user/1000/doc/6cdffe5
? Right?Sounds odd. I installed stuff once with
snap
and regretted it and backed out!One thought: just make sure the file you're picking is not a soft link into the
/run/user
area?ls -l /home/user/Documents/myFile.txt
before you open it, please. Or, make sure/home/user/Documents
hasn't been set up as some soft link to/run/user/1000/doc/...
!? -
Hi,
You are mentioning snap. You might want to give more details about how you are running your application because that's the kind of details that's pretty important to get help properly.
-
What I do in my snap is to dump the procompiled libs from Qt 5.14.
But probably I am forgetting to pull a necessary but not required lib or maybe precompiled Qt libs are not totally compatible with snapcraft.if I snap my app in the “traditional way”, using the qmake plugin and the qt 5.9 libs that comes with snap, everything works fine...
Finally, my question is: how do I create a snap for a Qt 5.14.1 application the right way??? Do you know of any example or tutorial?
-
You might want to check the linuxdeployqt project.
-
You might want to check the linuxdeployqt project.
@SGaist Snapcraft and appImage are not exactly the same thing.
Anyway, if someone else is trying to "snap" a Qt app using a different version then the old ones coming with snapcraft, I created a small project where you may find an hint:
https://github.com/jdelromano/snapqt5