diff --git a/editor/deploy.ts b/editor/deploy.ts index ced52bfb..21288926 100644 --- a/editor/deploy.ts +++ b/editor/deploy.ts @@ -63,7 +63,9 @@ const rbfTemplate = ` export function deployCoreAsync(resp: pxtc.CompileResult) { let w: pxt.editor.Ev3Wrapper - let filename = resp.downloadFileBaseName || "pxt" + const origElfUF2 = UF2.parseFile(pxt.U.stringToUint8Array(ts.pxtc.decodeBase64(resp.outfiles[pxt.outputName()]))) + + let filename = resp.downloadFileBaseName || (origElfUF2[0].filename || "").replace(/^Projects\//, "").replace(/\.elf$/, "") || "pxt" filename = filename.replace(/^lego-/, "") let fspath = "../prjs/BrkProg_SAVE/" @@ -77,8 +79,6 @@ export function deployCoreAsync(resp: pxtc.CompileResult) { let rbfBIN = pxt.U.fromHex(rbfHex) pxt.HF2.write16(rbfBIN, 4, rbfBIN.length) - let origElfUF2 = UF2.parseFile(pxt.U.stringToUint8Array(ts.pxtc.decodeBase64(resp.outfiles[pxt.outputName()]))) - let mkFile = (ext: string, data: Uint8Array = null) => { let f = UF2.newBlockFile() f.filename = "Projects/" + filename + ext