diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/save b/buildroot-v86/board/v86/rootfs_overlay/root/bin/save index 4f7d607..889b33f 100755 --- a/buildroot-v86/board/v86/rootfs_overlay/root/bin/save +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/save @@ -19,15 +19,20 @@ state(){ file(){ javascript=' - filename='$1' + filename="'$(pwd)/$1'" + res = "" - function saveUint8Array(uint8Array, filename = 'download.bin', mimeType = 'application/octet-stream') { + function saveUint8Array(uint8Array, filename = "download.bin", mimeType = "application/octet-stream") { + if( !uint8Array ){ + console.log( res = "file not found" ) + return false + } const blob = new Blob([uint8Array], { type: mimeType }); const url = URL.createObjectURL(blob); - const a = document.createElement('a'); + const a = document.createElement("a"); a.href = url; - a.download = filename; + a.download = filename.replace(/.*\//,""); // Programmatically trigger the click event document.body.appendChild(a); @@ -39,9 +44,9 @@ file(){ } let term = document.querySelector("[isoterminal]") - term.emit("read_file", [filename, (str,buf) > saveUint8Array(buf, filename) ) + term.emit("read_file", [filename, (str,buf) => saveUint8Array(buf, filename) ] ) - return "" + return res ' hook save js "$javascript" @@ -49,5 +54,5 @@ file(){ } test -z "$1" && state -test -n "$1" && file +test -n "$1" && file "$1" echo "Usage: save [file] # pass no argument to save VM state to localStorage" diff --git a/dist/v86-linux.iso b/dist/v86-linux.iso index f1a615c..60d1733 100644 Binary files a/dist/v86-linux.iso and b/dist/v86-linux.iso differ