Android root folder read access
-
wrote on 10 Jul 2019, 18:02 last edited by
Following code:
QTreeView* tv = new QTreeView(this); QFileSystemModel* fsm = new QFileSystemModel(this); tv->setModel( fsm ); 1: tv->setRootIndex( fsm->setRootPath( "//mnt/" ) ); // Android & Linux Ok 2: //tv->setRootIndex( fsm->setRootPath( QDir::rootPath() ) ); // Linux Ok, Android not
Code under label 1: in Android and Linux opens folder /mnt and gives it contents. But if comment it then uncomment code under label 2: - it works properly only in desktop Linux (even without root privileges). In Android it gives empty tree. Just nothing. Probably this is related to access rights but I cannot find anything about read access to root folder in Android. All Android file system managers give read access to root folder without root privileges. How do they do that? What yet required to do to get read access in Qt5 application? Is anybody here who solved this?
Please answer only if you do know answer. Do not tell about READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions. Application definitely has both - without it setRootPath( "//mnt/" ) cannot work.
-
Android file system managers give read access to root folder without root privileges
What? It is surprise for Google.
You need in the root access privileges to do that. It is not the Qt issue.
-
Android file system managers give read access to root folder without root privileges
What? It is surprise for Google.
You need in the root access privileges to do that. It is not the Qt issue.
-
Following code:
QTreeView* tv = new QTreeView(this); QFileSystemModel* fsm = new QFileSystemModel(this); tv->setModel( fsm ); 1: tv->setRootIndex( fsm->setRootPath( "//mnt/" ) ); // Android & Linux Ok 2: //tv->setRootIndex( fsm->setRootPath( QDir::rootPath() ) ); // Linux Ok, Android not
Code under label 1: in Android and Linux opens folder /mnt and gives it contents. But if comment it then uncomment code under label 2: - it works properly only in desktop Linux (even without root privileges). In Android it gives empty tree. Just nothing. Probably this is related to access rights but I cannot find anything about read access to root folder in Android. All Android file system managers give read access to root folder without root privileges. How do they do that? What yet required to do to get read access in Qt5 application? Is anybody here who solved this?
Please answer only if you do know answer. Do not tell about READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions. Application definitely has both - without it setRootPath( "//mnt/" ) cannot work.
-
@Gourmet maybe you can try QStorageInfo instead of QDir?
#include <QStorageInfo> QStorageInfo mySinfo = QStorageInfo::root(); tv->setRootIndex( fsm->setRootPath( mySinfo.rootPath() ) );
-
@kuzulis Root File Explorer works with root folder on devices without superuser access (root). And not only this FM can do that.
@Gourmet said in Android root folder read access:
Root File Explorer works with root folder on devices without superuser access (root)
This seems to be wrong:
"File Explorer Root Browser is a fully featured file manager & root browser for rooted superusers to take control of their Android device and root files & folders."
From https://play.google.com/store/apps/details?id=com.jrummy.root.browserfree&hl=en -
@Gourmet said in Android root folder read access:
Root File Explorer works with root folder on devices without superuser access (root)
This seems to be wrong:
"File Explorer Root Browser is a fully featured file manager & root browser for rooted superusers to take control of their Android device and root files & folders."
From https://play.google.com/store/apps/details?id=com.jrummy.root.browserfree&hl=en
6/7