fixed extractor for linux

This commit is contained in:
Clinton Hall 2013-02-28 18:34:48 -08:00
parent 0a3a2491d8
commit af2bcb3fd6

View file

@ -63,7 +63,7 @@ def extract(dirpath, file, outputDestination):
# ".bz2": ["bzip2", "-d --keep"],
EXTRACT_COMMANDS = {
".rar": ["unrar", "x -o+ -y"],
".rar": ["unrar", "x"],
".tar": ["tar", "-xf"],
".zip": ["unzip", ""],
".tar.gz": ["tar", "-xzf"], ".tgz": ["tar", "-xzf"],
@ -74,10 +74,10 @@ def extract(dirpath, file, outputDestination):
}
# Test command exists and if not, remove
for cmd in required_cmds:
if not which(cmd):
if call(['which', cmd]): #note, returns 0 if exists, or 1 if doesn't exist.
for k, v in EXTRACT_COMMANDS.items():
if cmd in v[0]:
log.error("EXTRACTOR: %s not found, disabling support for %s", cmd, k)
Logger.error("EXTRACTOR: %s not found, disabling support for %s", cmd, k)
del EXTRACT_COMMANDS[k]
if not EXTRACT_COMMANDS:
Logger.warn("EXTRACTOR: No archive extracting programs found, plugin will be disabled")