I found out that (on at least debian) the command to display a directory with the default file explorer is gvfs-open <dir path>
. It works fine but I want a file inside that directory to be selected.
In Qt I can open a directory with the default file explorer like this :
QDir dir = QFileInfo(filepath).absoluteDir(); //get the directory
QDesktopServices::openUrl( QUrl( "file:///" + dir.absolutePath() ) ); //open it
Same as gvfs-open <dir path>
.
If I use it like this it will open the default application to open the file instead of selecting it inside that directory :
QDesktopServices::openUrl( QUrl( "file:///" + filepath ) );
But how do I select a file in the default file explorer? I want to open the directory and select that file from filepath
. Or is that not possible?