@@ -23,6 +23,12 @@ public static async Task<int> Main(string[] args)
2323
2424 var rootCommand = new RootCommand ( ) ;
2525
26+ var typeTreeDataOpt = new Option < FileInfo > (
27+ aliases : new [ ] { "--typetree-data" , "-d" } ,
28+ description : "Path to an external TypeTree data file to load before processing bundles" ) ;
29+ typeTreeDataOpt . ExistingOnly ( ) ;
30+ rootCommand . AddGlobalOption ( typeTreeDataOpt ) ;
31+
2632 {
2733 var pathArg = new Argument < DirectoryInfo > ( "path" , "The path to the directory containing the files to analyze" ) . ExistingOnly ( ) ;
2834 var oOpt = new Option < string > ( aliases : new [ ] { "--output-file" , "-o" } , description : "Filename of the output database" , getDefaultValue : ( ) => "database.db" ) ;
@@ -187,6 +193,32 @@ public static async Task<int> Main(string[] args)
187193 rootCommand . AddCommand ( serializedFileCommand ) ;
188194 }
189195
196+ // Load external TypeTree data file before any command executes.
197+ for ( int i = 0 ; i < args . Length - 1 ; i ++ )
198+ {
199+ if ( args [ i ] == "--typetree-data" || args [ i ] == "-d" )
200+ {
201+ var typeTreeFile = args [ i + 1 ] ;
202+ if ( ! File . Exists ( typeTreeFile ) )
203+ {
204+ Console . Error . WriteLine ( $ "TypeTree data file not found: { typeTreeFile } ") ;
205+ UnityFileSystem . Cleanup ( ) ;
206+ return 1 ;
207+ }
208+ try
209+ {
210+ UnityFileSystem . AddTypeTreeSourceFromFile ( typeTreeFile ) ;
211+ }
212+ catch ( EntryPointNotFoundException )
213+ {
214+ Console . Error . WriteLine ( "Error: The loaded UnityFileSystemApi does not support external TypeTree data files. Please update to Unity 6.5 or newer." ) ;
215+ UnityFileSystem . Cleanup ( ) ;
216+ return 1 ;
217+ }
218+ break ;
219+ }
220+ }
221+
190222 var r = await rootCommand . InvokeAsync ( args ) ;
191223
192224 UnityFileSystem . Cleanup ( ) ;
0 commit comments