File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ program.command('list-project-templates')
327327 const templates = unityEditor . GetAvailableTemplates ( ) ;
328328
329329 if ( options . json ) {
330- process . stdout . write ( `\n{\"templates\": ${ JSON . stringify ( templates ) } }\n` ) ;
330+ process . stdout . write ( `\n${ JSON . stringify ( { templates } ) } \n` ) ;
331331 } else {
332332 process . stdout . write ( `Available project templates:\n` ) ;
333333 for ( const template of templates ) {
Original file line number Diff line number Diff line change @@ -129,15 +129,11 @@ export class UnityEditor {
129129 return templates ;
130130 }
131131
132- // Find all .tgz files in the template directory
133- const files = fs . readdirSync ( templateDir )
132+ // Find all .tgz packages in the template directory
133+ const packages = fs . readdirSync ( templateDir )
134134 . filter ( f => f . endsWith ( '.tgz' ) )
135135 . map ( f => path . join ( templateDir , f ) ) ;
136-
137- if ( files . length > 0 ) {
138- files . forEach ( f => templates . push ( path . basename ( f ) ) ) ;
139- }
140-
136+ templates . push ( ...packages . map ( f => path . basename ( f ) ) ) ;
141137 return templates ;
142138 }
143139
You can’t perform that action at this time.
0 commit comments