From 697d579df118681ec1ef2eafcb39308f8ded1935 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Tue, 23 Aug 2022 09:29:03 +0800 Subject: [PATCH] lizhouze@huawei.com Signed-off-by: lizhouze --- compiler/main.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index c506188..47f1f33 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -382,32 +382,31 @@ function loadModuleInfo(projectConfig, envArgs) { function checkAppResourcePath(appResourcePath, config) { if (appResourcePath) { - const appResourcePathSavePath = path.resolve(projectConfig.cachePath, 'resource_path.txt'); - saveAppResourcePath(appResourcePath, appResourcePathSavePath); readAppResource(resources, appResourcePath); if (fs.existsSync(appResourcePath) && config.cache) { config.cache.buildDependencies.config.push(appResourcePath); } - if (fs.existsSync(appResourcePathSavePath) && config.cache) { - config.cache.buildDependencies.config.push(appResourcePathSavePath); + if (!projectConfig.xtsMode) { + saveAppResourcePath(appResourcePath, appResourcePathSavePath); + if (fs.existsSync(appResourcePathSavePath) && config.cache) { + config.cache.buildDependencies.config.push(appResourcePathSavePath); + } } } } function saveAppResourcePath(appResourcePath, appResourcePathSavePath) { - if (!projectConfig.xtsMode) { - let isSave = false; - if (fs.existsSync(appResourcePathSavePath)) { - const saveContent = fs.readFileSync(appResourcePathSavePath); - if (appResourcePath !== saveContent) { - isSave = true; - } - } else { + let isSave = false; + if (fs.existsSync(appResourcePathSavePath)) { + const saveContent = fs.readFileSync(appResourcePathSavePath); + if (appResourcePath !== saveContent) { isSave = true; } - if (isSave) { - fs.writeFileSync(appResourcePathSavePath, appResourcePath); - } + } else { + isSave = true; + } + if (isSave) { + fs.writeFileSync(appResourcePathSavePath, appResourcePath); } }