mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 插件适配Windows
1. 适配windows 2. 应群友的建议提供小写r一样可以呼出帮助
This commit is contained in:
parent
791e8b827c
commit
dc1aa0769c
@ -16,17 +16,13 @@ export class help extends plugin {
|
|||||||
priority: 500,
|
priority: 500,
|
||||||
rule: [
|
rule: [
|
||||||
{
|
{
|
||||||
reg: '^#*R(插件)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$',
|
reg: '^#*(R|r)(插件)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$',
|
||||||
fnc: 'help'
|
fnc: 'help'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* rule - 闲心插件帮助
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
async help () {
|
async help () {
|
||||||
let data = await Help.get(this.e)
|
let data = await Help.get(this.e)
|
||||||
if (!data) return
|
if (!data) return
|
||||||
|
@ -136,11 +136,20 @@ function mergeAcFileToMp4(tsNames, FullFileName, outputFileName, shouldDelete =
|
|||||||
fs.writeFileSync(ffmpegList, concatStrs.join("\n"));
|
fs.writeFileSync(ffmpegList, concatStrs.join("\n"));
|
||||||
const outPath = path.resolve(outputFileName);
|
const outPath = path.resolve(outputFileName);
|
||||||
|
|
||||||
|
// 执行命令
|
||||||
let cmd = 'ffmpeg';
|
let cmd = 'ffmpeg';
|
||||||
const env = {
|
// 判断当前环境
|
||||||
...process.env,
|
let env;
|
||||||
PATH: '/usr/local/bin:' + child_process.execSync('echo $PATH').toString(),
|
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) => {
|
return new Promise((resolve, reject) => {
|
||||||
child_process.exec(
|
child_process.exec(
|
||||||
|
@ -63,10 +63,19 @@ function getDownloadUrl (url) {
|
|||||||
|
|
||||||
function mergeFileToMp4 (vFullFileName, aFullFileName, outputFileName, shouldDelete = true) {
|
function mergeFileToMp4 (vFullFileName, aFullFileName, outputFileName, shouldDelete = true) {
|
||||||
let cmd = 'ffmpeg';
|
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) => {
|
return new Promise((resolve, reject) => {
|
||||||
child_process.exec(
|
child_process.exec(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user