AssetDownloader: Make local qrc files readable in AssetDownloader
* Also warn using qrc resources for preferredLocalDownloadDir Change-Id: Id2b54bb1053483cf46f1ee1cbbc07250a2520f18 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit 4f53be92642c2c90dca28ca9b7795a0086e557b4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
859af49b97
commit
b0bcb24bad
@ -153,7 +153,13 @@ static QDir baseLocalDir(const QDir &preferredLocalDir)
|
||||
|
||||
static QString pathFromUrl(const QUrl &url)
|
||||
{
|
||||
return url.isLocalFile() ? url.toLocalFile() : url.toString();
|
||||
if (url.isLocalFile())
|
||||
return url.toLocalFile();
|
||||
|
||||
if (url.scheme() == u"qrc")
|
||||
return u":" + url.path();
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
static QList<QUrl> filterDownloadableAssets(const QList<QUrl> &assetFiles, const QDir &expectedDir)
|
||||
@ -200,8 +206,10 @@ QUrl AssetDownloader::preferredLocalDownloadDir() const
|
||||
|
||||
void AssetDownloader::setPreferredLocalDownloadDir(const QUrl &localDir)
|
||||
{
|
||||
if (!localDir.isLocalFile())
|
||||
qWarning() << "preferredLocalDownloadDir Should be a local directory";
|
||||
if (localDir.scheme() == u"qrc") {
|
||||
qWarning() << "Cannot set a qrc as preferredLocalDownloadDir";
|
||||
return;
|
||||
}
|
||||
|
||||
const QString path = pathFromUrl(localDir);
|
||||
if (d->m_preferredLocalDownloadDir != path) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user