fix(core): use archive_entry_pathname_utf8

Removes Windows specific code path.
This commit is contained in:
Oleg Shparber 2024-06-21 22:47:18 -04:00
parent 07a357cab0
commit 5081898eaa

View File

@ -65,12 +65,8 @@ void Extractor::extract(const QString &sourceFile, const QString &destination, c
// TODO: Do not strip root directory in archive if it equals to 'root'
archive_entry *entry;
while (archive_read_next_header(info.archiveHandle, &entry) == ARCHIVE_OK) {
#ifndef Q_OS_WIN32
QString pathname = QString::fromUtf8(archive_entry_pathname(entry));
#else
// TODO: Remove once https://github.com/libarchive/libarchive/issues/587 is resolved.
QString pathname = QString::fromWCharArray(archive_entry_pathname_w(entry));
#endif
// See https://github.com/libarchive/libarchive/issues/587 for more on UTF-8.
QString pathname = QString::fromUtf8(archive_entry_pathname_utf8(entry));
if (!root.isEmpty()) {
pathname.remove(0, pathname.indexOf(QLatin1String("/")) + 1);