File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
python/plugins/plugin_installer Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -90,26 +90,19 @@ def _listdirs(self, file):
9090 dirs = []
9191
9292 for file in zf .filelist :
93+ # It appears that all directories in a zip have a unique
94+ # signature in the external_attr of the ZipInfo object.
95+ # Shifting the external_attr by 28 will result in a value of 4
96+ # for all directories. This is undocumented in the Python zipfile
97+ # module but appears to be a solid way to identify directories
98+ # in a zip file.
9399 if file .external_attr >> 28 == 4 :
94- # print "Adding %s to the list of directories to create" % file.filename
95100 dirs .append (file .filename )
96101
97- #for name in zf.namelist():
98- # if name.endswith('/'):
99- # dirs.append(name)
100-
101- ## Check for subdirectories by assuming a file with length 0
102- ## is a directory (this isn't necessarily true but it allows
103- ## plugins with subdirectories to be installed)
104- #for file in zf.filelist:
105- # if file.file_size == 0:
106- # dirs.append(file.file_name)
107-
108-
109102 if len (dirs ) == 0 :
110103 # this means there is no top level directory in the
111104 # zip file. We'll assume the first entry contains the
112- # directory and use it
105+ # directory and use it, hoping for the best...
113106 entry = zf .namelist ()[0 ]
114107 dir = entry .split ('/' )[0 ]
115108 dir += '/'
You can’t perform that action at this time.
0 commit comments