Skip to content

Commit 173e2bf

Browse files
PR review
1 parent c6dd3fa commit 173e2bf

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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) {

src/unity-editor.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)