Skip to content

Commit 80e37a3

Browse files
committed
Refactored getRoot with interface for consumer.
Signed-off-by: ubi de feo <[email protected]>
1 parent c039ea5 commit 80e37a3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

ui/arduino/helpers.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import os
22
import json
33
import sys
4-
os.chdir('/')
54

65
def get_root(has_flash_mount = True):
76
if '/flash' in sys.path:
8-
print('/flash', end = '')
7+
return '/flash'
98
else:
10-
print('/', end = '')
9+
return '/'
1110

1211
def is_directory(path):
1312
return True if os.stat(path)[0] == 0x4000 else False
@@ -26,6 +25,9 @@ def get_all_files(path, array_of_files = []):
2625
return array_of_files
2726

2827

28+
def iget_root():
29+
print(get_root(), end='')
30+
2931
def ilist_all(path):
3032
print(json.dumps(get_all_files(path)))
3133

@@ -38,3 +40,5 @@ def delete_folder(path):
3840
if file['type'] == 'folder':
3941
os.rmdir(file['path'])
4042
os.rmdir(path)
43+
44+
os.chdir(get_root())

ui/arduino/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ async function getAvailablePorts() {
16941694

16951695
async function getBoardRoot() {
16961696
let output = await serialBridge.execFile(await getHelperFullPath())
1697-
output = await serialBridge.run(`get_root()`)
1697+
output = await serialBridge.run(`iget_root()`)
16981698
let boardRoot = ''
16991699
try {
17001700
// Extracting the json output from serial response

0 commit comments

Comments
 (0)