fix error message

when output directory doesn't have enough space to save the file
fixes #1015
pull/1023/head
Mikael Finstad 5 years ago
parent 42297546b4
commit e2175ab825
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -59,7 +59,7 @@ import {
checkDirWriteAccess, dirExists, openDirToast, isMasBuild, isStoreBuild, dragPreventer, doesPlayerSupportFile,
isDurationValid, isWindows, filenamify, getOutFileExtension, generateSegFileName, defaultOutSegTemplate,
hasDuplicates, havePermissionToReadFile, isMac, resolvePathIfNeeded, pathExists, html5ifiedPrefix, html5dummySuffix, findExistingHtml5FriendlyFile,
deleteFiles, getHtml5ifiedPath, isStreamThumbnail, getAudioStreams, getVideoStreams,
deleteFiles, getHtml5ifiedPath, isStreamThumbnail, getAudioStreams, getVideoStreams, isOutOfSpaceError,
} from './util';
import { formatDuration } from './util/duration';
import { adjustRate } from './util/rate-calculator';
@ -665,6 +665,10 @@ const App = memo(() => {
await ffmpegMergeFiles({ paths, outPath, outDir, allStreams, ffmpegExperimental, onProgress: setCutProgress, preserveMovData, movFastStart, preserveMetadataOnMerge, chapters });
openDirToast({ icon: 'success', dirPath: outDir, text: i18n.t('Files merged!') });
} catch (err) {
if (isOutOfSpaceError(err)) {
showDiskFull();
return;
}
errorToast(i18n.t('Failed to merge files. Make sure they are all of the exact same codecs'));
console.error('Failed to merge files', err);
} finally {
@ -1182,8 +1186,7 @@ const App = memo(() => {
console.error('stderr:', err.stderr);
if (err.exitCode === 1 || err.code === 'ENOENT') {
// A bit hacky but it works, unless someone has a file called "No space left on device" ( ͡° ͜ʖ ͡°)
if (typeof err.stderr === 'string' && err.stderr.includes('No space left on device')) {
if (isOutOfSpaceError(err)) {
showDiskFull();
return;
}

@ -287,3 +287,9 @@ export async function deleteFiles({ toDelete, paths: { previewFilePath, filePath
export const deleteDispositionValue = 'llc_disposition_remove';
export const mirrorTransform = 'matrix(-1, 0, 0, 1, 0, 0)';
// A bit hacky but it works, unless someone has a file called "No space left on device" ( ͡° ͜ʖ ͡°)
export const isOutOfSpaceError = (err) => (
err && (err.exitCode === 1 || err.code === 'ENOENT')
&& typeof err.stderr === 'string' && err.stderr.includes('No space left on device')
);

Loading…
Cancel
Save