Skip to content

Commit b97a22a

Browse files
committed
fix: check/initialize before modifying .rsdk.json
Otherwise jq will throw an error when .rsdk.json does not exist: ``` vscode ➜ /workspaces/rsdk (main) $ rsdk config infra.organizations.package CodeChenL jq: error: Could not open file .rsdk.json: No such file or directory ``` Signed-off-by: Jiali Chen <chenjiali@radxa.com>
1 parent 1cc820a commit b97a22a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libexec/rsdk/rsdk-config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ main() {
5757
2)
5858
local RSDK_TEMP_JSON VALUE="$2"
5959
RSDK_TEMP_JSON="$(mktemp)"
60+
61+
if ! [[ -f .rsdk.json ]]; then
62+
echo "{}" > .rsdk.json
63+
fi
64+
6065
jq -er --arg field "$FIELD" --arg value "$VALUE" 'setpath($field / "."; $value)' .rsdk.json >"$RSDK_TEMP_JSON"
6166
mv "$RSDK_TEMP_JSON" .rsdk.json
6267
;;

0 commit comments

Comments
 (0)