Skip to content

Commit 801d7b1

Browse files
authored
Merge pull request #110 from arduino/bugfix/saving
Bugfix/saving
2 parents 2893099 + 4c5fe4f commit 801d7b1

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

preload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const Serial = {
2424
execFile: async (path) => {
2525
return board.execfile(path)
2626
},
27-
get_prompt: async () => {
27+
getPrompt: async () => {
2828
return board.get_prompt()
2929
},
30-
keyboard_interrupt: async () => {
30+
keyboardInterrupt: async () => {
3131
await board.stop()
3232
return Promise.resolve()
3333
},

ui/arduino/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
<!-- Elements -->
2020
<script type="text/javascript" src="views/components/elements/button.js" charset="utf-8"></script>
2121
<script type="text/javascript" src="views/components/elements/editor.js" charset="utf-8"></script>
22-
<script type="text/javascript" src="views/components/elements/message.js" charset="utf-8"></script>
23-
<script type="text/javascript" src="views/components/elements/options.js" charset="utf-8"></script>
2422
<script type="text/javascript" src="views/components/elements/tab.js" charset="utf-8"></script>
2523
<script type="text/javascript" src="views/components/elements/terminal.js" charset="utf-8"></script>
2624

ui/arduino/store.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async function store(state, emitter) {
115115

116116
// Stop whatever is going on
117117
// Recover from getting stuck in raw repl
118-
await serial.get_prompt()
118+
await serial.getPrompt()
119119

120120
// Make sure there is a lib folder
121121
log('creating lib folder')
@@ -174,7 +174,7 @@ async function store(state, emitter) {
174174
emitter.emit('open-panel')
175175
emitter.emit('render')
176176
try {
177-
await serial.get_prompt()
177+
await serial.getPrompt()
178178
await serial.run(code)
179179
} catch(e) {
180180
log('error', e)
@@ -187,7 +187,7 @@ async function store(state, emitter) {
187187
}
188188
emitter.emit('open-panel')
189189
emitter.emit('render')
190-
await serial.get_prompt()
190+
await serial.getPrompt()
191191
})
192192
emitter.on('reset', async () => {
193193
log('reset')
@@ -272,6 +272,7 @@ async function store(state, emitter) {
272272
// Check if the current full path exists
273273
let fullPathExists = false
274274
if (openFile.source == 'board') {
275+
await serial.getPrompt()
275276
fullPathExists = await serial.fileExists(
276277
serial.getFullPath(
277278
state.boardNavigationRoot,
@@ -294,6 +295,7 @@ async function store(state, emitter) {
294295
if (openFile.source == 'board') {
295296
openFile.parentFolder = state.boardNavigationPath
296297
// Check for overwrite
298+
await serial.getPrompt()
297299
willOverwrite = await serial.fileExists(
298300
serial.getFullPath(
299301
state.boardNavigationRoot,
@@ -328,7 +330,7 @@ async function store(state, emitter) {
328330
const contents = openFile.editor.editor.state.doc.toString()
329331
try {
330332
if (openFile.source == 'board') {
331-
await serial.get_prompt()
333+
await serial.getPrompt()
332334
await serial.saveFileContent(
333335
serial.getFullPath(
334336
state.boardNavigationRoot,
@@ -918,7 +920,7 @@ async function store(state, emitter) {
918920
const contents = openFile.editor.editor.state.doc.toString()
919921
try {
920922
if (openFile.source == 'board') {
921-
await serial.get_prompt()
923+
await serial.getPrompt()
922924
await serial.saveFileContent(
923925
serial.getFullPath(
924926
state.boardNavigationRoot,
@@ -981,7 +983,7 @@ async function store(state, emitter) {
981983
const contents = openFile.editor.editor.state.doc.toString()
982984
try {
983985
if (openFile.source == 'board') {
984-
await serial.get_prompt()
986+
await serial.getPrompt()
985987
await serial.saveFileContent(
986988
serial.getFullPath(
987989
state.boardNavigationRoot,
@@ -1382,7 +1384,7 @@ async function getAvailablePorts() {
13821384
}
13831385

13841386
async function getBoardFiles(path) {
1385-
await serial.get_prompt()
1387+
await serial.getPrompt()
13861388
let files = await serial.ilistFiles(path)
13871389
files = files.map(f => ({
13881390
fileName: f[0],
@@ -1401,6 +1403,7 @@ function checkDiskFile({ root, parentFolder, fileName }) {
14011403

14021404
async function checkBoardFile({ root, parentFolder, fileName }) {
14031405
if (root == null || parentFolder == null || fileName == null) return false
1406+
await serial.getPrompt()
14041407
return serial.fileExists(
14051408
serial.getFullPath(root, parentFolder, fileName)
14061409
)

0 commit comments

Comments
 (0)