Skip to content

Commit 2b968b4

Browse files
Settings: mount /builtin after formatting filesystem
1 parent 40779ab commit 2b968b4

File tree

1 file changed

+9
-2
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.settings/assets

1 file changed

+9
-2
lines changed

internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ def save_setting(self, setting):
309309
return
310310
elif setting["key"] == "format_internal_data_partition":
311311
# Inspired by lvgl_micropython/lib/micropython/ports/esp32/modules/inisetup.py
312+
# Note: it would be nice to create a "FormatInternalDataPartition" activity with some progress or confirmation
312313
try:
313314
import vfs
314315
from flashbdev import bdev
@@ -326,9 +327,15 @@ def save_setting(self, setting):
326327
fs = vfs.VfsFat(bdev)
327328
print(f"Mounting {fs} at /")
328329
vfs.mount(fs, "/")
329-
print("Done formatting, refreshing apps...")
330+
print("Done formatting, (re)mounting /builtin")
331+
try:
332+
import freezefs_mount_builtin
333+
except Exception as e:
334+
# This will throw an exception if there is already a "/builtin" folder present
335+
print("settings.py: WARNING: could not import/run freezefs_mount_builtin: ", e)
336+
print("Done mounting, refreshing apps")
330337
PackageManager.refresh_apps()
331-
self.finish() # would be nice to show a "FormatInternalDataPartition" activity
338+
self.finish()
332339
return
333340

334341
ui = setting.get("ui")

0 commit comments

Comments
 (0)