]> git.phdru.name Git - dotfiles.git/blobdiff - bin/unzip.py
.vimrc: Set `visualbell` and `belloff`
[dotfiles.git] / bin / unzip.py
index a5d3cf35e20ab4f41d670fd4965233388d388897..8fd74266b4980068adb4028afd45d2dd8f38fbdd 100755 (executable)
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 """Unzip with encoded filenames
 
-   Written by Oleg Broytman. Copyright (C) 2009, 2010 PhiloSoft Design.
+   Written by Oleg Broytman. Copyright (C) 2009-2016 PhiloSoft Design.
 """
 
 import sys, os, time
@@ -26,15 +26,14 @@ out = '.'
 
 for zinfo in zf.infolist():
     path = zinfo.filename
-    if not isinstance(path, unicode):
+    if isinstance(path, bytes):
         path = path.decode('cp866')
     recoded_path = path.encode(default_encoding)
-    print recoded_path
+    print(recoded_path)
 
     if path.startswith('./'):
-        tgt = os.path.join(out, recoded_path[2:])
-    else:
-        tgt = os.path.join(out, recoded_path)
+        recoded_path = recoded_path[2:]
+    tgt = os.path.join(out, recoded_path)
 
     tgtdir = os.path.dirname(tgt)
     if not os.path.exists(tgtdir):