evil RAR files
Alexandre Detiste
alexandre.detiste at gmail.com
Thu Apr 30 13:50:09 UTC 2015
I had this working, but didn't pushed it...
wouldn't-it be considered outright evil
to accept all "unknown", "non/official" RAR file.
If it's ok should we use this
https://packages.debian.org/sid/python3-rarfile
to get a listing of contents first ?
Anyway, this is not a priority.
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index ff43356..d3c7a79 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1040,9 +1040,18 @@ class GameData(object):
logger.warning('file "%s" does not match any known file', path)
# ... still G-D-P should try to process any random .zip
# file thrown at it, like the .zip provided by GamersHell
- if os.path.splitext(path)[1].lower() == '.zip':
+ ext = os.path.splitext(path)[1].lower()
+ if ext == '.zip':
with zipfile.ZipFile(path, 'r') as zf:
self.consider_zip(path, zf)
+ elif ext == '.rar' and is_installed('unrar'):
+ tmpdir = os.path.join(self.get_workdir(), 'tmp',
+ os.path.basename(path) + '.d')
+ mkdir_p(tmpdir)
+ subprocess.check_call(['unrar-nonfree', 'x',
+ os.path.abspath(path)], cwd=tmpdir)
+ self.consider_file_or_dir(tmpdir)
+
More information about the Pkg-games-devel
mailing list