Unarr: support unicode filenames

This commit is contained in:
Felix Kauselmann 2017-09-19 23:16:58 +02:00
parent 169904421c
commit 2250422cb6

View File

@ -4,16 +4,17 @@
#include <QDebug> #include <QDebug>
#include "extract_delegate.h" #include "extract_delegate.h"
extern"C" {
#include <unarr.h> #include <unarr.h>
}
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) : CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :
QObject(parent),valid(false),tools(true),numFiles(0),ar(NULL),stream(NULL) QObject(parent),valid(false),tools(true),numFiles(0),ar(NULL),stream(NULL)
{ {
//open file //open file
stream = ar_open_file(filePath.toStdString().c_str()); #ifdef Q_OS_WIN
stream = ar_open_file_w((wchar_t *)filePath.utf16());
#else
stream = ar_open_file(filePath.toLocal8Bit().constData());
#endif
if (!stream) if (!stream)
{ {
return; return;