Skip to content

Commit

Permalink
Removal of dead code and explanation of the method for determining wh…
Browse files Browse the repository at this point in the history
…ich directories are contained in the zip file of the plugin

git-svn-id: http://svn.osgeo.org/qgis/trunk@7971 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
gsherman committed Jan 15, 2008
1 parent 403a34b commit aa9c5ef
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions python/plugins/plugin_installer/qgis_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,19 @@ def _listdirs(self, file):
dirs = []

for file in zf.filelist:
# It appears that all directories in a zip have a unique
# signature in the external_attr of the ZipInfo object.
# Shifting the external_attr by 28 will result in a value of 4
# for all directories. This is undocumented in the Python zipfile
# module but appears to be a solid way to identify directories
# in a zip file.
if file.external_attr >> 28 == 4:
# print "Adding %s to the list of directories to create" % file.filename
dirs.append(file.filename)

#for name in zf.namelist():
# if name.endswith('/'):
# dirs.append(name)

## Check for subdirectories by assuming a file with length 0
## is a directory (this isn't necessarily true but it allows
## plugins with subdirectories to be installed)
#for file in zf.filelist:
# if file.file_size == 0:
# dirs.append(file.file_name)


if len(dirs) == 0:
# this means there is no top level directory in the
# zip file. We'll assume the first entry contains the
# directory and use it
# directory and use it, hoping for the best...
entry = zf.namelist()[0]
dir = entry.split('/')[0]
dir += '/'
Expand Down

0 comments on commit aa9c5ef

Please sign in to comment.