Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tinystudio",
"version": "0.1.0",
"version": "0.1.1",
"description": "An open-source desktop + web IDE for building, wiring, simulating, and flashing tiny hardware projects — code, circuit, and visual views in one place.",
"main": "./out/main/index.js",
"author": "MR.INDUSTRIES",
Expand Down
17 changes: 16 additions & 1 deletion src/renderer/src/commands/fileCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,22 @@ export class LoadGitHubProjectCommand implements Command {
)
}

const name = this.path ? this.path.split('/').pop()! : this.repo

// Desktop: materialize the project to a real folder so arduino-cli (via
// tinyService) can read it from disk. The in-memory `mem://` path is not a
// real file path and can't be compiled/uploaded. The browser has no disk to
// write to, so it falls back to the virtual workspace (view/edit only; the
// Arduino service guards mem:// compile/upload with a clear message).
if (fileSystem.isElectron()) {
const dir = `${await window.api.app.getExamplesDir()}/${name}`
for (const [rel, content] of Object.entries(files)) {
await fileSystem.writeFile(`${dir}/${rel}`, content)
}
await new OpenWorkspaceCommand(dir).execute()
return
}

const root = `${VIRTUAL_PREFIX}${this.owner}/${this.repo}${this.path ? '/' + this.path : ''}`
virtualFileSystem.clear(root)
await virtualFileSystem.seed(root, files)
Expand All @@ -291,7 +307,6 @@ export class LoadGitHubProjectCommand implements Command {
const fsItems = await fileSystem.readDirectory(root, true)
const fileItems = buildNestedStructure(fsItems)

const name = this.path ? this.path.split('/').pop()! : this.repo
const workspace: Workspace = {
id: crypto.randomUUID(),
name,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/StatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function StatusBar(): React.JSX.Element {
<div className="flex items-center gap-4 font-mono">
<p>UTF-8</p>
<p>Arduino (C++)</p>
<p>tinyStudio 0.1.0 · alpha</p>
<p>tinyStudio 0.1.1 · alpha</p>
</div>
</div>
)
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/src/services/arduino/WebSocketArduinoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ export class WebSocketArduinoService implements ArduinoService {
throw new Error('Arduino client not initialized')
}

if (workspacePath.startsWith('mem://')) {
const msg =
'This example is open in the browser (in-memory) and has no folder on disk for the compiler. Open it in the desktop app, or save it to a local folder, to compile and upload.'
return { success: false, output: msg, errors: [{ message: msg, severity: 'fatal' }] }
}

// Compile the sketch
console.log(
`Starting compile operation for workspace: ${workspacePath}, FQBN: ${boardConfig.fqbn}`
Expand Down Expand Up @@ -474,6 +480,12 @@ export class WebSocketArduinoService implements ArduinoService {
throw new Error('Arduino client not initialized')
}

if ((workspacePathOrBinary || '').startsWith('mem://')) {
const msg =
'This example is open in the browser (in-memory) and has no folder on disk for the compiler. Open it in the desktop app, or save it to a local folder, to compile and upload.'
return { success: false, output: msg, error: msg }
}

// Upload the sketch
console.log(
`Starting upload operation to port: ${port}, FQBN: ${boardConfig.fqbn}, workspace: ${workspacePathOrBinary}`
Expand Down
Loading