1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-25 19:52:44 +01:00

improve error message on startup #1114

This commit is contained in:
Mikael Finstad 2022-07-25 17:59:17 +08:00
parent 32ec2ea290
commit 36f34aff60
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
2 changed files with 20 additions and 2 deletions

View File

@ -56,6 +56,7 @@ import {
extractStreams, runStartupCheck, setCustomFfPath as ffmpegSetCustomFfPath,
isIphoneHevc, tryMapChaptersToEdl, blackDetect,
getDuration, getTimecodeFromStreams, createChaptersFromSegments, extractSubtitleTrack,
getFfmpegPath,
} from './ffmpeg';
import { shouldCopyStreamByDefault, getAudioStreams, getRealVideoStreams, defaultProcessedCodecTypes, isAudioDefinitelyNotSupported, doesPlayerSupportFile } from './util/streams';
import { exportEdlFile, readEdlFile, saveLlcProject, loadLlcProject, askForEdlImport } from './edlStore';
@ -2272,7 +2273,24 @@ const App = memo(() => {
const haveCustomFfPath = !!customFfPath;
useEffect(() => {
if (!haveCustomFfPath) runStartupCheck().catch((err) => handleError('LosslessCut is installation is broken', err));
if (!haveCustomFfPath) {
(async () => {
try {
await runStartupCheck();
} catch (err) {
if (['EPERM', 'EACCES'].includes(err.code)) {
toast.fire({
timer: 30000,
icon: 'error',
title: 'Fatal: ffmpeg not accessible',
text: `Got ${err.code}. This probably means that anti-virus is blocking execution of ffmpeg. Please make sure the following file exists and is executable:\n\n${getFfmpegPath()}\n\nSee this issue: https://github.com/mifi/lossless-cut/issues/1114`,
});
return;
}
handleError('Fatal: ffmpeg non-functional', err);
}
})();
}
}, [haveCustomFfPath]);
useEffect(() => {

View File

@ -116,7 +116,7 @@ export function handleError(arg1, arg2) {
toast.fire({
icon: 'error',
title: msg || i18n.t('An error has occurred.'),
text: errorMsg ? errorMsg.substr(0, 300) : undefined,
text: errorMsg ? errorMsg.substring(0, 300) : undefined,
});
}