ios: report correct file flags for assets 'directory'

If the asset url indicates that this file engine points
to the asset folder, report the file as a directory.
Also, if the app is authorized to access assets, report
that the directory has read access.

Change-Id: Ic8f656fa30a1b2a0ec6402e8b19256bdf5f7345e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
bb10
Richard Moe Gustavsen 2015-04-24 13:24:42 +02:00
parent 7bc241c8d3
commit 4a4faedc3d
1 changed files with 5 additions and 2 deletions

View File

@ -169,7 +169,10 @@ bool QIOSFileEngineAssetsLibrary::close()
QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractFileEngine::FileFlags type) const
{
QAbstractFileEngine::FileFlags flags = 0;
if (!loadAsset())
const bool isDir = (m_assetUrl == QLatin1String("assets-library://"));
const bool exists = isDir || loadAsset();
if (!exists)
return flags;
if (type & FlagsMask)
@ -180,7 +183,7 @@ QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractF
flags |= ReadOwnerPerm | ReadUserPerm | ReadGroupPerm | ReadOtherPerm;
}
if (type & TypesMask)
flags |= FileType;
flags |= isDir ? DirectoryType : FileType;
return flags;
}