@@ -179,6 +179,7 @@ async function store(state, emitter) {
179179 // Connected and ready
180180 state . isConnecting = false
181181 state . isConnected = true
182+ state . boardNavigationPath = await getBoardNavigationPath ( )
182183 updateMenu ( )
183184 if ( state . view === 'editor' && state . panelHeight <= PANEL_CLOSED ) {
184185 state . panelHeight = state . savedPanelHeight
@@ -288,7 +289,10 @@ async function store(state, emitter) {
288289 }
289290 emitter . emit ( 'open-panel' )
290291 emitter . emit ( 'render' )
291- await serialBridge . getPrompt ( )
292+ if ( state . isConnected ) {
293+ await serialBridge . getPrompt ( )
294+ }
295+
292296 } )
293297 emitter . on ( 'reset' , async ( ) => {
294298 log ( 'reset' )
@@ -606,7 +610,7 @@ async function store(state, emitter) {
606610 }
607611 await serialBridge . saveFileContent (
608612 serialBridge . getFullPath (
609- '/' ,
613+ state . boardNavigationRoot ,
610614 state . boardNavigationPath ,
611615 fileNameParameter
612616 ) ,
@@ -785,7 +789,7 @@ async function store(state, emitter) {
785789 if ( file . source === 'board' ) {
786790 await serialBridge . removeFile (
787791 serialBridge . getFullPath (
788- '/' ,
792+ state . boardNavigationRoot ,
789793 state . boardNavigationPath ,
790794 file . fileName
791795 )
@@ -1695,6 +1699,23 @@ async function getAvailablePorts() {
16951699 return await serialBridge . loadPorts ( )
16961700}
16971701
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+
16981719async function getBoardFiles ( path ) {
16991720 await serialBridge . getPrompt ( )
17001721 let files = await serialBridge . ilistFiles ( path )
0 commit comments