ZipUtil: check zip file external attributes for folder.

Folders in a zip file usually but not necessarily have their filename ending
with a slash. In these cases recognizing a folder entry by the last character
fails. Check the external attributes as well, which also contain the FAT file
attributes.

Change-Id: I81b039b3774b803b2b528bc83846aafd208e5571
This commit is contained in:
Dominik Riebeling 2012-05-31 20:31:43 +02:00
parent f8aa5c4ec0
commit f494c3c325

View file

@ -100,6 +100,12 @@ bool ZipUtil::extractArchive(QString& dest, QString file)
// if the entry is a path ignore it. Path existence is ensured separately. // if the entry is a path ignore it. Path existence is ensured separately.
if(m_zip->getCurrentFileName().split("/").last() == "") if(m_zip->getCurrentFileName().split("/").last() == "")
continue; continue;
// some tools set the MS-DOS file attributes. Check those for D flag,
// since in some cases a folder entry does not end with a /
QuaZipFileInfo fi;
currentFile->getFileInfo(&fi);
if(fi.externalAttr & 0x10) // FAT entry bit 4 indicating directory
continue;
QString outfilename; QString outfilename;
if(!singleoutfile.isEmpty() if(!singleoutfile.isEmpty()