Quazip在Mac 10.9, Qt 5.4和clang(64位)上抛出错误

Quazip throws an error on Mac 10.9, Qt 5.4 and clang(64 bit)

本文关键字:64位 clang 错误 出错 Mac Qt Quazip      更新时间:2023-10-16

我试图在我的Qt 5.4项目中使用Quazip 0.7.1(使用clang在同一台机器上使用Qt 5.4编译)来压缩存档中的文件。代码在使用MSVC 2012编译器的Windows上工作良好,但是相同的代码在Mac OSX上崩溃,错误为QIODevice::open file access not specified。下面是我的代码片段。

bool Utils::Archive(QList<QString> arrFiles, QString strFileName)
{
    QFile zipFile(strFileName);
    QuaZip zip(&zipFile);
    // CODE CRASHES HERE
    if(!zip.open(QuaZip::mdAppend))
    {
      qWarning("testCreate(): zip.open(): %d", zip.getZipError());
      return false;
    }

代码在压缩文件上崩溃。打开电话。任何建议/想法将不胜感激。由于

好吧,这是我的代码工作得很好,从比较它到你的im调用打开Quazip对象之前的Quazip文件也许尝试像我说它对我有用。我使用mdCreate,但我确定这也适用于mdappend

// Create new zip file to store the file.
auto zip_file(new QuaZip(file_path.string().c_str()));
if(zip_file->open(QuaZip::mdCreate))
{
    QuaZipFile file(zip_file);
    if(file.open(QIODevice::WriteOnly, QuaZipNewInfo("something.xml")) == false)
    {
         // Error
    }
    else
    {
        // Do stuff...
    }