Skip to content

Commit 5587e45

Browse files
authored
Update run_desktop.sh to fix settings being ignored
Script would not be able to start in dark mode, config.json was backed up but never used. config.json is not backed up anymore, change if this is needed still. We overwrite the auto_start_app if we launch it with a specific app.
1 parent e916515 commit 5587e45

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)