MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / terminalRestore

Function terminalRestore

src/settings/terminalSettings.js:354–390  ·  view source on GitHub ↗

* Restores terminal installation

()

Source from the content-addressed store, hash-verified

352 * Restores terminal installation
353 */
354 async function terminalRestore() {
355 try {
356 await Executor.execute("rm -rf $PREFIX/aterm_backup.*");
357
358 sdcard.openDocumentFile(
359 async (data) => {
360 loader.showTitleLoader();
361 //this will create a file at $PREFIX/atem_backup.tar.tar
362 await system.copyToUri(
363 data.uri,
364 cordova.file.dataDirectory,
365 "aterm_backup.tar",
366 console.log,
367 console.error,
368 );
369
370 // Restore
371 await Terminal.restore();
372
373 //Cleanup restore file
374 await Executor.execute("rm -rf $PREFIX/aterm_backup.*");
375
376 loader.removeTitleLoader();
377 alert(
378 strings.success.toUpperCase(),
379 `${strings["restored successfully"]}.`,
380 );
381 },
382 toast,
383 "application/x-tar",
384 );
385 } catch (error) {
386 loader.removeTitleLoader();
387 console.error("Terminal restore failed:", error);
388 toast(error.toString());
389 }
390 }
391}
392
393/**

Callers 1

callbackFunction · 0.85

Calls 5

alertFunction · 0.85
openDocumentFileMethod · 0.65
executeMethod · 0.45
errorMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected