fix codecheck

Signed-off-by: chen-zhongwei050 <chenzhongwei050@chinasoftinc.com>
This commit is contained in:
chen-zhongwei050 2024-08-14 09:25:59 +08:00
parent d2ab355d9c
commit 4cfdcab433
17 changed files with 24 additions and 31 deletions

View File

@ -194,7 +194,7 @@ cat hdf_devhost.cfg
![image-20240724093743837](./figures/pic_show_hostid.png)
2.运行可执行文件hdf_devhost手动拉起host进入/vendor/bin路径下运行可执行文件hdf_devhost传入一个参数为hostId第二个参数为hostName运行命令如下所示
2.运行可执行文件hdf_devhost手动拉起host进入/vendor/bin路径下运行可执行文件hdf_devhost传入一个参数为hostId第二个参数为hostName运行命令如下所示
```
./hdf_devhost 14 hello_host

View File

@ -111,7 +111,7 @@ cat hdf_devhost.cfg
![image-20240724093743837](./figures/pic_show_hostid.png)
2.运行可执行文件hdf_devhost手动拉起host进入/vendor/bin路径下运行可执行文件hdf_devhost传入一个参数为hostId第二个参数为hostName运行命令如下所示
2.运行可执行文件hdf_devhost手动拉起host进入/vendor/bin路径下运行可执行文件hdf_devhost传入一个参数为hostId第二个参数为hostName运行命令如下所示
```
./hdf_devhost 14 hello_host

View File

@ -12,19 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const path = require('path');
const fs = require('fs');
/**
* 获取Json文件内容
* @returns
*/
function getJsonCfg(jsonFilePath) {
let jsonCfg = null; // json 配置文件
let jsonFile = fs.readFileSync(jsonFilePath, { encoding: 'utf8' });
jsonCfg = JSON.parse(jsonFile);
return jsonCfg;
}
const path = require('path');
function replaceAll(s, sfrom, sto) {
while (s.indexOf(sfrom) >= 0) {
@ -33,29 +22,19 @@ function replaceAll(s, sfrom, sto) {
return s;
}
// 创建路径
function createDirectorySync(directoryPath) {
try {
if (!fs.existsSync(directoryPath)) {
fs.mkdirSync(directoryPath, { recursive: true });
}
} catch (err) {
console.error(`无法创建文件夹 ${directoryPath}: ${err}`);
}
function getJsonCfg(jsonFilePath) {
let jsonCfg = null;
let jsonFile = fs.readFileSync(jsonFilePath, { encoding: 'utf8' });
jsonCfg = JSON.parse(jsonFile);
return jsonCfg;
}
function pathJoin(...args) {
return path.join(...args);
}
// 写文件
function writeFile(fn, str) {
fs.writeFileSync(fn, str, { encoding: 'utf8' });
}
function utf8ArrayToStr(array) {
let char2, char3;
let outStr = '';
let len = array.length;
let i = 0;
@ -94,6 +73,20 @@ function readFile(fn) {
return data;
}
function createDirectorySync(directoryPath) {
try {
if (!fs.existsSync(directoryPath)) {
fs.mkdirSync(directoryPath, { recursive: true });
}
} catch (err) {
console.error(`无法创建文件夹 ${directoryPath}: ${err}`);
}
}
function writeFile(fn, str) {
fs.writeFileSync(fn, str, { encoding: 'utf8' });
}
/* driverframework
* drivername:用户输入的驱动名out:生成框架路径
* 1. 读取json文件模板
@ -112,7 +105,7 @@ function genDriverFramework(driverName, out = '') {
'driverName': driverName,
'namespaceName': namespaceName,
'idlFileName': idlFileName,
}
};
// 生成Hcs配置文件
genHcsconfigFile(frameworkJson, driverName, frameworkPath);