File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,16 @@ if [ -f "$script" ]; then
6262 " $binary " -v -i " $script "
6363else
6464 echo " Running app $script "
65- mv data/com.micropythonos.settings/config.json data/com.micropythonos.settings/config.json.backup
66- # When $script is empty, it just doesn't find the app and stays at the launcher
67- echo ' {"auto_start_app": "' $script ' "}' > data/com.micropythonos.settings/config.json
65+ CONFIG_FILE=" data/com.micropythonos.settings/config.json"
66+ # Check if config.json exists
67+ if [ -f " $CONFIG_FILE " ]; then
68+ # Update the auto_start_app field using sed
69+ sed -i ' ' -e ' s/"auto_start_app": ".*"/"auto_start_app": "' $script ' "/' " $CONFIG_FILE "
70+ else
71+ # If config.json doesn't exist, create it with auto_start_app
72+ echo ' {"auto_start_app": "' $script ' "}' > " $CONFIG_FILE "
73+ fi
6874 " $binary " -X heapsize=$HEAPSIZE -v -i -c " $( cat main.py) "
69- mv data/com.micropythonos.settings/config.json.backup data/com.micropythonos.settings/config.json
7075fi
7176
7277popd
You can’t perform that action at this time.
0 commit comments