From 79b928fe65ffe6bca4437e37db195abf02b4e1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=88=98?= <40414978+PatriceJiang@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:57:25 +0800 Subject: [PATCH] 3.6 bugfix build template replace proj_name (#11654) --- scripts/native-pack-tool/source/base/default.ts | 4 ++++ scripts/native-pack-tool/source/utils.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/scripts/native-pack-tool/source/base/default.ts b/scripts/native-pack-tool/source/base/default.ts index 847c7eba66..36ddc994d9 100644 --- a/scripts/native-pack-tool/source/base/default.ts +++ b/scripts/native-pack-tool/source/base/default.ts @@ -83,6 +83,10 @@ export abstract class NativePackTool { init(params: CocosParams) { this.params = new CocosParams(params); this.paths = new Paths(params); + + this.setEnv('NATIVE_DIR', this.paths.platformTemplateDirInPrj); + this.setEnv('COMMON_DIR', this.paths.commonDirInPrj); + this.setEnv('PROJECT_NAME', this.params.projectName); } protected parseVersion(content: string, key: string, def: number): number { diff --git a/scripts/native-pack-tool/source/utils.ts b/scripts/native-pack-tool/source/utils.ts index b26ac93cde..e080016198 100644 --- a/scripts/native-pack-tool/source/utils.ts +++ b/scripts/native-pack-tool/source/utils.ts @@ -280,6 +280,7 @@ export class cchelper { static async replaceInFile(patterns: { reg: string, text: string }[], filepath: string) { filepath = this.replaceEnvVariables(filepath); if (!fs.existsSync(filepath)) { + console.log(`While replace template content, file ${filepath}`); return; } // console.log(`replace ${filepath} with ${JSON.stringify(patterns)}`);