Skip to content

Commit

Permalink
add out of space dialog #328
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi committed Jan 18, 2021
1 parent 73aec12 commit b9bde3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
checkDirWriteAccess, dirExists, openDirToast, isMasBuild, isStoreBuild, dragPreventer, doesPlayerSupportFile,
isDurationValid, isWindows,
} from './util';
import { askForOutDir, askForImportChapters, createNumSegments, createFixedDurationSegments, promptTimeOffset, askForHtml5ifySpeed, askForYouTubeInput, askForFileOpenAction, confirmExtractAllStreamsDialog, cleanupFilesDialog } from './dialogs';
import { askForOutDir, askForImportChapters, createNumSegments, createFixedDurationSegments, promptTimeOffset, askForHtml5ifySpeed, askForYouTubeInput, askForFileOpenAction, confirmExtractAllStreamsDialog, cleanupFilesDialog, showDiskFull } from './dialogs';
import { openSendReportDialog } from './reporting';
import { fallbackLng } from './i18n';
import { createSegment, createInitialCutSegments, getCleanCutSegments, getSegApparentStart, findSegmentsAtCursor } from './segments';
Expand Down Expand Up @@ -1101,6 +1101,11 @@ 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')) {
showDiskFull();
return;
}
handleCutFailed(err);
return;
}
Expand Down
7 changes: 7 additions & 0 deletions src/dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ export async function askForFileOpenAction() {
return value;
}

export async function showDiskFull() {
await Swal.fire({
icon: 'error',
text: i18n.t('You ran out of space'),
});
}

export async function askForImportChapters() {
const { value } = await Swal.fire({
icon: 'question',
Expand Down

0 comments on commit b9bde3b

Please sign in to comment.