Fix warning and handle file scheme like files better.

Calling setFileName() prints a warning if the path is reset
without calling close() before.
Convert the source path with file:/// scheme to local file.

Change-Id: Ie21e7e8ad8f76dbe1afc1843ff5bf7fb4598123a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
kh1 2014-10-10 15:55:08 +02:00 committed by Karsten Heimrich
parent 6857a0e87e
commit bc91a2204e
2 changed files with 3 additions and 2 deletions

View File

@ -64,8 +64,8 @@ int BinaryReplace::replace(const QString &source, const QString &target)
QFutureWatcher<QInstaller::FileTaskResult> taskWatcher;
if (url.isRelative() || url.isLocalFile()) {
taskWatcher.setFuture(QtConcurrent::run(&QInstaller::CopyFileTask::doTask,
new QInstaller::CopyFileTask(QInstaller::FileTaskItem(QFileInfo(source)
.absoluteFilePath()))));
new QInstaller::CopyFileTask(QInstaller::FileTaskItem(url.isRelative()
? QFileInfo(source).absoluteFilePath() : url.toLocalFile()))));
} else {
taskWatcher.setFuture(QtConcurrent::run(&QInstaller::DownloadFileTask::doTask,
new QInstaller::DownloadFileTask(QInstaller::FileTaskItem(url.toString()))));

View File

@ -120,6 +120,7 @@ int main(int argc, char *argv[])
fi.setFile(bundlePath);
path = fi.absolutePath() + QLatin1Char('/') + fi.baseName() + QLatin1String(".dat");
tmp.close();
tmp.setFileName(path);
QInstaller::openForRead(&tmp);