Fix read file from a zip module that points to real outside file.
bzr revid: ced-95329ecbf74237e1399443471809240fafa811c2
This commit is contained in:
parent
8ceadbc1d6
commit
ee3e6600fb
|
@ -192,9 +192,12 @@ def file_open(name, mode="r", subdir='addons'):
|
|||
if zipfile.is_zipfile(head+'.zip'):
|
||||
import StringIO
|
||||
zfile = zipfile.ZipFile(head+'.zip')
|
||||
return StringIO.StringIO(zfile.read(os.path.join(
|
||||
os.path.basename(head), zipname).replace(
|
||||
os.sep, '/')))
|
||||
try:
|
||||
return StringIO.StringIO(zfile.read(os.path.join(
|
||||
os.path.basename(head), zipname).replace(
|
||||
os.sep, '/')))
|
||||
except:
|
||||
pass
|
||||
if os.path.isfile(name):
|
||||
return file(name, mode)
|
||||
|
||||
|
|
Loading…
Reference in New Issue