Skip to content

Commit 7cff865

Browse files
main.py: add support for updated launcher app
1 parent e2b0e32 commit 7cff865

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

internal_filesystem/main.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,23 @@ def start_app(app_dir, is_launcher=False):
352352
start_script_fullpath = f"{app_dir}/{start_script}"
353353
execute_script_new_thread(start_script_fullpath, True, is_launcher, True)
354354

355+
# Execute this if it exists
355356
execute_script_new_thread("/autorun.py", True, False, False)
356-
start_app("/apps/com.example.launcher", True)
357+
358+
try:
359+
import freezefs_mount
360+
except Exception as e:
361+
print("/main.py: WARNING: could not import freezefs_mount: ", e)
362+
363+
# The launcher might have been updated from the builtin one, so check that:
364+
import uos
365+
custom_launcher = "/apps/com.example.launcher"
366+
builtin_launcher = "/apps_builtin/com.example.launcher"
367+
try:
368+
stat = uos.stat(custom_launcher)
369+
start_app(custom_launcher, True)
370+
except OSError:
371+
start_app(builtin_launcher, True)
357372

358373
# If we got this far without crashing, then no need to rollback the update
359374
import ota.rollback

0 commit comments

Comments
 (0)