feat: 插件适配Windows

1. 适配windows
2. 应群友的建议提供小写r一样可以呼出帮助
This commit is contained in:
zhiyu1998 2023-02-11 02:19:09 +08:00
parent 791e8b827c
commit dc1aa0769c
3 changed files with 27 additions and 13 deletions

View File

@ -16,17 +16,13 @@ export class help extends plugin {
priority: 500,
rule: [
{
reg: '^#*R(插件)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$',
reg: '^#*(R|r)(插件)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$',
fnc: 'help'
}
]
})
}
/**
* rule - 闲心插件帮助
* @returns
*/
async help () {
let data = await Help.get(this.e)
if (!data) return

View File

@ -136,11 +136,20 @@ function mergeAcFileToMp4(tsNames, FullFileName, outputFileName, shouldDelete =
fs.writeFileSync(ffmpegList, concatStrs.join("\n"));
const outPath = path.resolve(outputFileName);
// 执行命令
let cmd = 'ffmpeg';
const env = {
...process.env,
PATH: '/usr/local/bin:' + child_process.execSync('echo $PATH').toString(),
};
// 判断当前环境
let env;
if (process.platform === "win32") {
env = process.env
} else if (process.platform === "linux") {
env = {
...process.env,
PATH: '/usr/local/bin:' + child_process.execSync('echo $PATH').toString(),
};
} else {
console.log("暂时不支持当前操作系统!")
}
return new Promise((resolve, reject) => {
child_process.exec(

View File

@ -63,10 +63,19 @@ function getDownloadUrl (url) {
function mergeFileToMp4 (vFullFileName, aFullFileName, outputFileName, shouldDelete = true) {
let cmd = 'ffmpeg';
const env = {
...process.env,
PATH: '/usr/local/bin:' + child_process.execSync('echo $PATH').toString(),
};
// 判断当前环境
let env;
if (process.platform === "win32") {
env = process.env
} else if (process.platform === "linux") {
env = {
...process.env,
PATH: '/usr/local/bin:' + child_process.execSync('echo $PATH').toString(),
};
} else {
console.log("暂时不支持当前操作系统!")
}
return new Promise((resolve, reject) => {
child_process.exec(