繁体   English   中英

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

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

我试图在我的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;
    }

代码在zip.open调用上崩溃。 任何建议/想法将不胜感激。 谢谢

好吧,这是我的代码,可以很好地工作,并且可以将其与您在Quazip文件之前对im调用Quazip对象上的open进行比较,然后像我说的那样对我有用。 我使用了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...
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM