about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Jastrzębski <[email protected]>2015-09-06 18:26:15 +0200
committerPaweł Jastrzębski <[email protected]>2015-09-06 18:26:15 +0200
commitc6179b0064ee535bb8070df65241ddbac3325423 (patch)
tree61fd4bf55398b6c50081c7472c1da9ec430e8135
parentCLI: Additional source path cleanup (close #152) (diff)
downloadkcc-c6179b0064ee535bb8070df65241ddbac3325423.tar.gz
kcc-c6179b0064ee535bb8070df65241ddbac3325423.tar.bz2
kcc-c6179b0064ee535bb8070df65241ddbac3325423.zip
Tweaked CBZ detection
-rw-r--r--kcc/rarfile.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/kcc/rarfile.py b/kcc/rarfile.py
index 567f5ce..afb19a7 100644
--- a/kcc/rarfile.py
+++ b/kcc/rarfile.py
@@ -360,9 +360,8 @@ class RarCannotExec(RarExecError):
 
 def is_rarfile(xfile):
     '''Check quickly whether file is rar archive.'''
-    fd = XFile(xfile)
-    buf = fd.read(len(RAR_ID))
-    fd.close()
+    with open(xfile, 'rb') as fh:
+        buf = fh.read(len(RAR_ID))
     if buf == RAR_ID or buf == RAR5_ID:
         return True
     else: