@@ -9,6 +9,7 @@ pub mod ios_widget;
99mod utoc_utils;
1010mod welcome;
1111
12+ use crate :: main_ui:: RepakModManager ;
1213use eframe:: egui:: { self , IconData } ;
1314use log:: { info, LevelFilter } ;
1415use retoc:: { action_unpack, ActionUnpack , FGuid } ;
@@ -19,10 +20,11 @@ use std::fs::{create_dir, File};
1920use std:: path:: PathBuf ;
2021use std:: process:: exit;
2122use std:: str:: FromStr ;
23+ use std:: sync:: atomic:: AtomicI32 ;
2224use std:: sync:: Arc ;
2325
24- use crate :: main_ui :: RepakModManager ;
25-
26+ use crate :: install_mod :: install_mod_logic :: iotoc :: convert_directory_to_iostore ;
27+ use crate :: install_mod :: map_to_mods_internal ;
2628#[ cfg( target_os = "windows" ) ]
2729use { rfd:: MessageButtons , std:: panic:: PanicHookInfo } ;
2830
@@ -121,6 +123,26 @@ fn main() {
121123 }
122124 exit ( 0 ) ;
123125 }
126+ if args[ 1 ] == "--pack" {
127+ let paths = args[ 2 ..]
128+ . iter ( )
129+ . map ( |path| PathBuf :: from_str ( path) . unwrap ( ) )
130+ . filter ( |path| path. is_dir ( ) )
131+ . collect :: < Vec < _ > > ( ) ;
132+ let installable_mods = map_to_mods_internal ( & paths) ;
133+ for ( i, installable) in installable_mods. iter ( ) . enumerate ( ) {
134+ let mod_dir = paths[ i] . parent ( ) . unwrap ( ) ;
135+ let count = AtomicI32 :: new ( 0 ) ;
136+ convert_directory_to_iostore (
137+ & installable,
138+ mod_dir. to_path_buf ( ) ,
139+ paths[ i] . clone ( ) ,
140+ & count,
141+ )
142+ . expect ( "Failed to convert directory" ) ;
143+ }
144+ exit ( 0 ) ;
145+ }
124146 }
125147
126148 // This forces repak gui to use the XWAYLAND backend instead of the wayland as wayland backend is half baked as shit
0 commit comments