← Back to team overview

ubuntu-phone team mailing list archive

Re: [ubuntu-phone] QStorageInfo::bytesAvailable() returns bytes available from root path if the app is Apparmor restricted

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On 23.06.2015 17:20, Frans Schreuder wrote:
> I would like to show the space available for downloading maps in
> the OSMScout app. QStorageInfo::bytesAvailable() provides exactly
> the information that I need, however when the application is
> confined, it returns the free space on "/" in stead of the folder I
> specified which is "
> /home/phablet/.local/share/osmscout.fransschreuder/"
> 
> Is there a way to get the space available as a normal user?

Just initialize the QStorageInfo object with the path to your app's data:

QStorageInfo(QStandardPaths::writableLocation(QStandardPaths::DataLocation));

http://doc.qt.io/qt-5/qstorageinfo.html#QStorageInfo-2

Ciao,
  Alberto
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlWJdlEACgkQVLQegMXeCFIe8QCfSPfl82tASn1360LEdR71/bzp
BmcAn36s7WjExqrukFdGJaIeJGG6MklT
=ZRt5
-----END PGP SIGNATURE-----


Follow ups

References