Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions ui/arduino/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import os
import json
import sys
os.chdir('/')

def get_root(has_flash_mount = True):
if '/flash' in sys.path:
print('/flash', end = '')
else:
print('/', end = '')

def is_directory(path):
return True if os.stat(path)[0] == 0x4000 else False

Expand Down
18 changes: 18 additions & 0 deletions ui/arduino/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ async function store(state, emitter) {
// Connected and ready
state.isConnecting = false
state.isConnected = true
state.boardNavigationRoot = await getBoardRoot()
updateMenu()
if (state.view === 'editor' && state.panelHeight <= PANEL_CLOSED) {
state.panelHeight = state.savedPanelHeight
Expand Down Expand Up @@ -1691,6 +1692,23 @@ async function getAvailablePorts() {
return await serialBridge.loadPorts()
}

async function getBoardRoot() {
let output = await serialBridge.execFile(await getHelperFullPath())
output = await serialBridge.run(`get_root()`)
let boardRoot = ''
try {
// Extracting the json output from serial response
output = output.substring(
output.indexOf('OK')+2,
output.indexOf('\x04')
)
boardRoot = output
} catch (e) {
log('error', output)
}
return boardRoot
}

async function getBoardFiles(path) {
await serialBridge.getPrompt()
let files = await serialBridge.ilistFiles(path)
Expand Down