File tree Expand file tree Collapse file tree 1 file changed +5
-18
lines changed
python/plugins/plugin_installer Expand file tree Collapse file tree 1 file changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -95,24 +95,11 @@ def _listdirs(self, file):
95
95
96
96
dirs = []
97
97
98
- for file in zf .filelist :
99
- # It appears that all directories in a zip have a unique
100
- # signature in the external_attr of the ZipInfo object.
101
- # Shifting the external_attr by 28 will result in a value of 4
102
- # for all directories. This is undocumented in the Python zipfile
103
- # module but appears to be a solid way to identify directories
104
- # in a zip file.
105
- if file .external_attr >> 28 == 4 :
106
- dirs .append (file .filename )
107
-
108
- if len (dirs ) == 0 :
109
- # this means there is no top level directory in the
110
- # zip file. We'll assume the first entry contains the
111
- # directory and use it, hoping for the best...
112
- entry = zf .namelist ()[0 ]
113
- dir = entry .split ('/' )[0 ]
114
- dir += '/'
115
- dirs .append (dir )
98
+ for name in zf .namelist ():
99
+ (path , filename ) = os .path .split (name )
100
+
101
+ if path not in dirs :
102
+ dirs .append (path )
116
103
117
104
dirs .sort ()
118
105
return dirs
You can’t perform that action at this time.
0 commit comments