Details
Description
If mounted only internal storage on device, QStorageInfo for this storage is invalid and rootPath is empty.
Example internal storage mounted to /storage/sdcard0:
QStorageInfo storage = QStorageInfo("/storage/sdcard0"); qDebug() << "rootPath:" << storage.rootPath(); qDebug() << "name:" << storage.name(); qDebug() << "fileSystemType:" << storage.fileSystemType(); qDebug() << "size:" << storage.bytesTotal()/1000/1000 << "MB"; qDebug() << "availableSize:" << storage.bytesAvailable()/1000/1000 << "MB";
Output:
rootPath: ""
name: ""
fileSystemType: ""
size: 0 MB
availableSize: 0 MB
If we insert external sdcard it works correctly:
Output:
rootPath: "/storage/sdcard0"
name: ""
fileSystemType: "fuse"
size: 2205 MB
availableSize: 1538 MB