@@ -179,6 +179,7 @@ async function store(state, emitter) {
179
179
// Connected and ready
180
180
state . isConnecting = false
181
181
state . isConnected = true
182
+ state . boardNavigationPath = await getBoardNavigationPath ( )
182
183
updateMenu ( )
183
184
if ( state . view === 'editor' && state . panelHeight <= PANEL_CLOSED ) {
184
185
state . panelHeight = state . savedPanelHeight
@@ -288,7 +289,10 @@ async function store(state, emitter) {
288
289
}
289
290
emitter . emit ( 'open-panel' )
290
291
emitter . emit ( 'render' )
291
- await serialBridge . getPrompt ( )
292
+ if ( state . isConnected ) {
293
+ await serialBridge . getPrompt ( )
294
+ }
295
+
292
296
} )
293
297
emitter . on ( 'reset' , async ( ) => {
294
298
log ( 'reset' )
@@ -606,7 +610,7 @@ async function store(state, emitter) {
606
610
}
607
611
await serialBridge . saveFileContent (
608
612
serialBridge . getFullPath (
609
- '/' ,
613
+ state . boardNavigationRoot ,
610
614
state . boardNavigationPath ,
611
615
fileNameParameter
612
616
) ,
@@ -785,7 +789,7 @@ async function store(state, emitter) {
785
789
if ( file . source === 'board' ) {
786
790
await serialBridge . removeFile (
787
791
serialBridge . getFullPath (
788
- '/' ,
792
+ state . boardNavigationRoot ,
789
793
state . boardNavigationPath ,
790
794
file . fileName
791
795
)
@@ -1695,6 +1699,23 @@ async function getAvailablePorts() {
1695
1699
return await serialBridge . loadPorts ( )
1696
1700
}
1697
1701
1702
+ async function getBoardNavigationPath ( ) {
1703
+ let output = await serialBridge . execFile ( await getHelperFullPath ( ) )
1704
+ output = await serialBridge . run ( `iget_root()` )
1705
+ let boardRoot = ''
1706
+ try {
1707
+ // Extracting the json output from serial response
1708
+ output = output . substring (
1709
+ output . indexOf ( 'OK' ) + 2 ,
1710
+ output . indexOf ( '\x04' )
1711
+ )
1712
+ boardRoot = output
1713
+ } catch ( e ) {
1714
+ log ( 'error' , output )
1715
+ }
1716
+ return boardRoot
1717
+ }
1718
+
1698
1719
async function getBoardFiles ( path ) {
1699
1720
await serialBridge . getPrompt ( )
1700
1721
let files = await serialBridge . ilistFiles ( path )
0 commit comments