Skip to content

Commit

Permalink
fix: switch to correct env based on file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
sverben committed May 3, 2024
1 parent 3907ea2 commit 4b5fbe4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/lib/components/core/header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,19 @@ async function openProject() {
handle.set(new FileHandle(file));
const content = await file.getFile();
serialization.workspaces.load(JSON.parse(await content.text()), $workspace);
if (file.name.endsWith('.ino')) {
mode.set(Mode.ADVANCED)
code.set(await content.text())
} else if (file.name.endsWith('.py')) {
mode.set(Mode.PYTHON)
robot.set(robots["l_nano_rp2040"])
code.set(await content.text())
} else {
mode.set(Mode.BLOCKS)
robot.set(robots[file.name.split(".").at(-1)])
serialization.workspaces.load(JSON.parse(await content.text()), $workspace);
}
}
async function saveProject() {
Expand Down

0 comments on commit 4b5fbe4

Please sign in to comment.