From f494c3c3255c32a6b83a1c06aeba614e10c4d8b6 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Thu, 31 May 2012 20:31:43 +0200 Subject: 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 --- rbutil/rbutilqt/base/ziputil.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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() -- cgit v1.2.3