Skip to content

Commit 1afc546

Browse files
Merge pull request MicroPythonOS#22 from QuasiKili/patch-7
Update run_desktop.sh to fix settings being ignored
2 parents 0b53d6a + 5587e45 commit 1afc546

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/run_desktop.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ if [ -f "$script" ]; then
6262
"$binary" -v -i "$script"
6363
else
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
7075
fi
7176

7277
popd

0 commit comments

Comments
 (0)