Skip to content

Commit 944602f

Browse files
committed
Persist local folder path on localStorage
1 parent b7512b0 commit 944602f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/arduino/store.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function store(state, emitter) {
2323
state.selectedFile = null
2424
state.selectedDevice = 'disk'
2525

26-
state.diskPath = null
26+
state.diskPath = localStorage.getItem('diskPath')
2727
state.serialPath = null
2828

2929
state.isConnected = false
@@ -202,6 +202,9 @@ function store(state, emitter) {
202202
emitter.on('open-folder', async () => {
203203
log('open-folder')
204204
let { folder, files } = await disk.openFolder()
205+
// disk.openFolder() returns *string* 'null' because of `ipc`
206+
folder = folder === 'null' ? null : folder
207+
localStorage.setItem('diskPath', folder)
205208
state.diskPath = folder
206209
state.diskFiles = files
207210
if (!state.isFilesOpen) emitter.emit('show-files')
@@ -238,6 +241,7 @@ function store(state, emitter) {
238241
(a, b) => a.localeCompare(b)
239242
)
240243
} catch (e) {
244+
state.diskPath = null
241245
console.log('error', e)
242246
}
243247
}

0 commit comments

Comments
 (0)