!88 replace by absolute path

Merge pull request !88 from houhaoyu/abspath
This commit is contained in:
openharmony_ci
2021-10-28 09:15:19 +00:00
committed by Gitee
2 changed files with 7 additions and 6 deletions
+4 -4
View File
@@ -57,11 +57,11 @@ function loadEntryObj(projectPath, device_level, abilityType, manifestFilePath)
if (!fs.existsSync(appJSPath)) {
throw Error(red + 'ERROR: missing app.js' + reset).message;
}
entryObj['./app'] = projectPath + '/app.js?entry';
entryObj['./app'] = path.resolve(projectPath, './app.js?entry');
}
break;
default:
entryObj[`./${abilityType}`] = projectPath + `/${abilityType}.js?entry`;
entryObj[`./${abilityType}`] = path.resolve(projectPath + `./${abilityType}.js?entry`);
break
}
return entryObj;
@@ -83,9 +83,9 @@ function addPageEntryObj(manifest, projectPath) {
if (isHml && isVisual) {
throw Error(red + 'ERROR: ' + sourcePath + ' cannot both have hml && visual').message;
} else if (isHml) {
entryObj['./' + element] = hmlPath + '?entry';
entryObj['./' + element] = path.resolve(projectPath, './' + sourcePath + '.hml?entry');
} else if (isVisual) {
entryObj['./' + element] = visualPath + '?entry';
entryObj['./' + element] = path.resolve(aceSuperVisualPath, './' + sourcePath + '.visual?entry');
}
})
return entryObj;
+3 -2
View File
@@ -162,14 +162,15 @@ function addPageEntryObj() {
const visualPath = path.join(aceSuperVisualPath, sourcePath + '.visual');
const isHml = fs.existsSync(hmlPath);
const isVisual = fs.existsSync(visualPath);
const projectPath = process.env.projectPath;
if (isHml && isVisual) {
logWarn(this, [{
reason: 'ERROR: ' + sourcePath + ' cannot both have hml && visual',
}]);
} else if (isHml) {
entryObj['./' + element] = hmlPath + '?entry';
entryObj['./' + element] = path.resolve(projectPath, './' + sourcePath + '.hml?entry');
} else if (isVisual) {
entryObj['./' + element] = visualPath + '?entry';
entryObj['./' + element] = path.resolve(aceSuperVisualPath, './' + sourcePath + '.visual?entry');
}
});
}