@@ -358,19 +358,28 @@ def extract_volume_iso(args: argparse.Namespace):
358
358
359
359
output_dir = str (args .dir )
360
360
361
- for dirname , dirlist , filelist in iso .walk (iso_path = '/' ):
361
+ if not args .extension :
362
+ path_type = 'iso_path'
363
+ elif args .extension == 'joliet' :
364
+ path_type = 'joliet_path'
365
+ elif args .extension == 'rr' :
366
+ path_type = 'rr_type'
367
+ else :
368
+ path_type = 'udf_path'
369
+
370
+ arg = {path_type : '/' }
371
+
372
+ for dirname , dirlist , filelist in iso .walk (** arg ):
362
373
pwd = output_dir + dirname
363
374
for dir in dirlist :
364
375
joined_path = os .path .join (pwd , dir )
365
376
os .makedirs (joined_path , exist_ok = True )
366
377
for file in filelist :
367
378
filename = file .split (';' )[0 ]
368
- if dirname != '/' :
369
- iso_file_path = dirname + '/' + file
370
- else :
371
- iso_file_path = dirname + file
379
+ iso_file_path = os .path .join (dirname , filename )
372
380
with open (os .path .join (pwd , filename ), 'wb' ) as f :
373
- iso .get_file_from_iso_fp (outfp = f , iso_path = iso_file_path )
381
+ arg [path_type ] = iso_file_path
382
+ iso .get_file_from_iso_fp (outfp = f , ** arg )
374
383
375
384
iso .close ()
376
385
@@ -824,6 +833,7 @@ def generate_parser() -> argparse.ArgumentParser:
824
833
parser_iso9660 .add_argument (
825
834
"--log" , metavar = "LEVEL" , help = "set logging level" , default = "INFO"
826
835
)
836
+ parser_iso9660 .add_argument ("--extension" , choices = ['joliet' , 'rr' , 'udf' ], metavar = "EXTENSION" , help = "Use if the iso9660 has an extension" )
827
837
parser_iso9660 .add_argument ("src" , metavar = "INPUT" , type = Path , help = "Disk image" )
828
838
parser_iso9660 .add_argument (
829
839
"dir" , metavar = "OUTPUT" , type = Path , help = "Destination folder"
0 commit comments