@@ -201,7 +201,7 @@ def __init__(
201201 self .size = size
202202 self .result = result
203203
204- self .extract_dir = get_extract_dir_for_input (config , self .task .path )
204+ self .carve_dir = get_extract_dir_for_input (config , self .task .path )
205205
206206 def process (self ):
207207 logger .debug ("Processing file" , path = self .task .path , size = self .size )
@@ -229,7 +229,7 @@ def _process_chunks(
229229 unknown_chunks : List [UnknownChunk ],
230230 ):
231231 carved_unknown_paths = carve_unknown_chunks (
232- self .extract_dir , file , unknown_chunks
232+ self .carve_dir , file , unknown_chunks
233233 )
234234 self ._calculate_entropies (carved_unknown_paths )
235235
@@ -239,28 +239,28 @@ def _process_chunks(
239239 def _ensure_root_extract_dir (self ):
240240 # ensure that the root extraction directory is created even for empty extractions
241241 if self .task .depth == 0 :
242- self .extract_dir .mkdir (parents = True , exist_ok = True )
242+ self .carve_dir .mkdir (parents = True , exist_ok = True )
243243
244244 def _calculate_entropies (self , paths : List [Path ]):
245245 if self .task .depth < self .config .entropy_depth :
246246 for path in paths :
247247 calculate_entropy (path , draw_plot = self .config .entropy_plot )
248248
249249 def _extract_chunk (self , file , chunk : ValidChunk ):
250- # Skip carving whole file and thus duplicating the file and creating more directories
251250 is_whole_file_chunk = chunk .start_offset == 0 and chunk .end_offset == self .size
251+
252252 skip_carving = is_whole_file_chunk
253253 if skip_carving :
254254 inpath = self .task .path
255- outdir = self .extract_dir
255+ extract_dir = self .carve_dir
256256 carved_path = None
257257 else :
258- inpath = carve_valid_chunk (self .extract_dir , file , chunk )
259- outdir = self .extract_dir / (inpath .name + self .config .extract_suffix )
258+ inpath = carve_valid_chunk (self .carve_dir , file , chunk )
259+ extract_dir = self .carve_dir / (inpath .name + self .config .extract_suffix )
260260 carved_path = inpath
261261
262262 try :
263- chunk .extract (inpath , outdir )
263+ chunk .extract (inpath , extract_dir )
264264
265265 if carved_path and not self .config .keep_extracted_chunks :
266266 logger .debug ("Removing extracted chunk" , path = carved_path )
@@ -275,12 +275,12 @@ def _extract_chunk(self, file, chunk: ValidChunk):
275275 self .result .add_report (UnknownError (exception = exc ))
276276
277277 # we want to get consistent partial output even in case of unforeseen problems
278- fix_extracted_directory (outdir , self .result )
278+ fix_extracted_directory (extract_dir , self .result )
279279
280- if outdir .exists ():
280+ if extract_dir .exists ():
281281 self .result .add_subtask (
282282 Task (
283- path = outdir ,
283+ path = extract_dir ,
284284 depth = self .task .depth + 1 ,
285285 )
286286 )
0 commit comments