Do not use libcurl for reading local files

We originally used libcurl for both downloading images from
Internet and reading local files to have the same code path for both.

It doesn't work that well in practice, as Qt and libcurl are not
on the same page how special characters such as Chinese characters
are represented in a local file URL.

So create a new class to handle local files.

Closes #76
This commit is contained in:
Floris Bos 2020-06-01 19:43:51 +02:00
parent 123542a66b
commit fa7637e7dc
6 changed files with 115 additions and 8 deletions

View file

@ -8,6 +8,7 @@
#include "downloadextractthread.h"
#include "dependencies/drivelist/src/drivelist.hpp"
#include "driveformatthread.h"
#include "localfileextractthread.h"
#include <archive.h>
#include <archive_entry.h>
#include <QFileInfo>
@ -182,7 +183,11 @@ void ImageWriter::startWrite()
urlstr = QUrl::fromLocalFile(_cacheFileName).toString(_src.FullyEncoded).toLatin1();
}
if (compressed)
if (QUrl(urlstr).isLocalFile())
{
_thread = new LocalFileExtractThread(urlstr, _dst.toLatin1(), _expectedHash, this);
}
else if (compressed)
{
_thread = new DownloadExtractThread(urlstr, _dst.toLatin1(), _expectedHash, this);
}