]> khamidou — GitHub mirrors - electron.git/commitdiff
Use unzip command on Mac to keep symbol links in zip file work.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 21 Jun 2013 02:32:57 +0000 (10:32 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 21 Jun 2013 02:32:57 +0000 (10:32 +0800)
script/lib/util.py

index f4f42be926c7431ae7a2463b8280f68d3d9330cd..ab33187065446a06934a2f2a5aa06e1f137883a8 100644 (file)
@@ -3,6 +3,8 @@
 import atexit
 import errno
 import shutil
+import subprocess
+import sys
 import tarfile
 import tempfile
 import urllib2
@@ -44,8 +46,12 @@ def extract_tarball(tarball_path, member, destination):
 
 
 def extract_zip(zip_path, destination):
-  with zipfile.ZipFile(zip_path) as z:
-    z.extractall(destination)
+  if sys.platform == 'darwin':
+    # Use unzip command on Mac to keep symbol links in zip file work.
+    subprocess.check_call(['unzip', zip_path, '-d', destination])
+  else:
+    with zipfile.ZipFile(zip_path) as z:
+      z.extractall(destination)
 
 
 def safe_unlink(path):