diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-05-31 20:31:43 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-05-31 20:44:45 +0200 |
commit | f494c3c3255c32a6b83a1c06aeba614e10c4d8b6 (patch) | |
tree | 2afb0babf0544f33caa78d6156e6084c7756f10a | |
parent | f8aa5c4ec0e08a87cfcd765f89bbbc571d75d2ae (diff) |
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
-rw-r--r-- | rbutil/rbutilqt/base/ziputil.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/ziputil.cpp b/rbutil/rbutilqt/base/ziputil.cpp index d70cf8c9b3..ca921eb708 100644 --- a/rbutil/rbutilqt/base/ziputil.cpp +++ b/rbutil/rbutilqt/base/ziputil.cpp @@ -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(m_zip->getCurrentFileName().split("/").last() == "") 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; if(!singleoutfile.isEmpty() |