Skip to content

Commit 12ef620

Browse files
committed
fix: insufficient permissions for ffprobe in linux
1 parent 1e15b06 commit 12ef620

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

electron-builder.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ publish:
6464
# provider: generic
6565
# url: http://localhost:3000
6666
beforePack: scripts/install-darwin-deps.js
67-
afterPack: scripts/cleaned-unused-arch-deps.js
67+
afterPack: scripts/after-pack.js
6868
afterSign: scripts/notarize.js
6969
releaseInfo:
7070
releaseNotes: |
7171
优化导入字幕提示信息
7272
修复改变窗口大小后字幕消失的问题
73-
73+
修复在 Linux 上无法播放视频报错的问题
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
import { exec as execCallback } from 'node:child_process'
33
import { promisify } from 'node:util'
44

5+
import fixLinuxPermissions from './fix-linux-permissions.js'
6+
57
const exec = promisify(execCallback)
68

79
export default async function installDarWinDeps(context) {
10+
await fixLinuxPermissions(context)
811
const { packager, arch } = context
912
const platform = packager.platform.nodeName
1013
if (platform !== 'darwin') {

scripts/fix-linux-permissions.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import fs from 'node:fs';
2+
import path from 'node:path';
3+
4+
export default async function fixLinuxPermissions(context) {
5+
const { packager } = context;
6+
const platform = packager.platform.nodeName;
7+
if (platform !== 'linux') {
8+
return;
9+
}
10+
11+
const { appOutDir } = context;
12+
const ffprobePath = path.join(
13+
appOutDir,
14+
'resources',
15+
'app.asar.unpacked',
16+
'node_modules',
17+
'@ffprobe-installer',
18+
'linux-x64',
19+
'ffprobe'
20+
);
21+
22+
try {
23+
// 检查文件是否存在
24+
if (fs.existsSync(ffprobePath)) {
25+
// 添加执行权限
26+
fs.chmodSync(ffprobePath, '755');
27+
console.info('Successfully added execute permission to ffprobe');
28+
} else {
29+
console.warn('ffprobe not found in resources directory');
30+
}
31+
} catch (error) {
32+
console.error('Error fixing ffprobe permissions:', error);
33+
}
34+
}

0 commit comments

Comments
 (0)