2424
2525 os .remove (meta_file_path )
2626
27- addon_type = meta .get ("type" )
28-
29- if addon_type == "mcaddon" :
30- output_path = os .path .join (rootdir , addondir )
31- shutil .make_archive (output_path , 'zip' , full_path )
32-
33- os .rename (f"{ output_path } .zip" , f"{ output_path } .mcaddon" )
34-
35- elif addon_type == "mcpack" :
36- archive_root = meta .get ("archive_root" )
37-
38- subfolder = os .path .join (full_path , archive_root )
39-
40- if os .path .isdir (subfolder ):
41- output_path = os .path .join (rootdir , f"{ addondir } " )
42-
43- shutil .make_archive (output_path , 'zip' , subfolder )
44- os .rename (f"{ output_path } .zip" , f"{ output_path } .mcpack" )
45- else :
27+ archive_type = meta .get ("type" )
28+ archive_root = meta .get ("archive_root" )
29+
30+ if archive_root :
31+ full_archive_root = os .path .join (full_path , archive_root )
32+
33+ if not os .path .isdir (full_archive_root ):
4634 print (f"{ archive_root } folder missing in { addondir } " )
4735 sys .exit (1 )
48-
4936 else :
50- print (f"Unknown type in meta.json for { addondir } " )
51- sys .exit (1 )
37+ full_archive_root = full_path
38+
39+ shutil .make_archive (full_path , 'zip' , full_archive_root )
40+ os .rename (f"{ full_path } .zip" , f"{ full_path } .{ archive_type } " )
0 commit comments