import { SaveGame } from 'satisfactory-json' ; import { SaveFileReader , SaveGameLoading } from '../core/SaveGameLoading' ; import { openFileFromFilesystem } from './openFile' ; class DesktopFileReader implements SaveFileReader { readFile ( filepath , asJson , progressCallback , errorCallback , successCallback ) { openFileFromFilesystem ( filepath , asJson , ( err , progress , saveGame ) => { if ( err ) { errorCallback ( err ) ; return ; } if ( progress ) { progressCallback ( progress ) ; return ; } if ( saveGame ) { successCallback ( saveGame ) ; return ; } } ) ; } } /**
 * Supply a file path to open the file
 */ export function openFileAndMoveToEditor ( vue , path , asJson ) { const name = path . replace ( /^.*[\\/]/ , '' ) ; new SaveGameLoading ( vue , new DesktopFileReader ( ) ) . loadSaveGame ( name , path , asJson ) ; }