Commit 31632a32 by devttys0

Merge pull request #209 from Lekensteyn/extractor-fixes

Fix custom output directory for extracted files
parents 0efe0e13 ec6204a6
...@@ -102,8 +102,11 @@ class Extractor(Module): ...@@ -102,8 +102,11 @@ class Extractor(Module):
def load(self): def load(self):
# Holds a list of extraction rules loaded either from a file or when manually specified. # Holds a list of extraction rules loaded either from a file or when manually specified.
self.extract_rules = [] self.extract_rules = []
# The input file specific output directory path (to be determined at runtime) # The input file specific output directory path (default to CWD)
self.directory = None if self.base_directory:
self.directory = os.path.realpath(self.base_directory)
else:
self.directory = os.getcwd()
# Key value pairs of input file path and output extraction path # Key value pairs of input file path and output extraction path
self.output = {} self.output = {}
# Number of extracted files # Number of extracted files
...@@ -426,10 +429,6 @@ class Extractor(Module): ...@@ -426,10 +429,6 @@ class Extractor(Module):
basedir = os.path.dirname(path) basedir = os.path.dirname(path)
basename = os.path.basename(path) basename = os.path.basename(path)
# Make sure we put the initial extraction directory in the CWD
if self.directory is None:
self.directory = os.getcwd()
if basedir != self.directory: if basedir != self.directory:
# During recursive extraction, extracted files will be in subdirectories # During recursive extraction, extracted files will be in subdirectories
# of the CWD. This allows us to figure out the subdirectory by simply # of the CWD. This allows us to figure out the subdirectory by simply
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment