From fb74bb76d94a6c55632376c931fc108131260ee9 Mon Sep 17 00:00:00 2001 From: Reputable2772 <153411261+Reputable2772@users.noreply.github.com> Date: Tue, 18 Mar 2025 19:14:38 +0530 Subject: [PATCH] vscode: fix creation of storage.json file (#6650) Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com> --- modules/programs/vscode.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/programs/vscode.nix b/modules/programs/vscode.nix index d90c5dd14..69b7e1812 100644 --- a/modules/programs/vscode.nix +++ b/modules/programs/vscode.nix @@ -299,14 +299,14 @@ in { pkgs.writeShellScript "vscode-global-storage-modify" '' PATH=${makeBinPath [ pkgs.jq ]}''${PATH:+:}$PATH file="${userDir}/globalStorage/storage.json" + file_write="" + profiles=(${ + escapeShellArgs + (flatten (mapAttrsToList (n: v: n) allProfilesExceptDefault)) + }) if [ -f "$file" ]; then existing_profiles=$(jq '.userDataProfiles // [] | map({ (.name): .location }) | add // {}' "$file") - file_write="" - profiles=(${ - escapeShellArgs - (flatten (mapAttrsToList (n: v: n) allProfilesExceptDefault)) - }) for profile in "''${profiles[@]}"; do if [[ "$(echo $existing_profiles | jq --arg profile $profile 'has ($profile)')" != "true" ]] || [[ "$(echo $existing_profiles | jq --arg profile $profile 'has ($profile)')" == "true" && "$(echo $existing_profiles | jq --arg profile $profile '.[$profile]')" != "\"$profile\"" ]]; then @@ -318,6 +318,7 @@ in { file_write="$file_write$([ "$file_write" != "" ] && echo "...")$profile" done + mkdir -p $(dirname "$file") echo "{}" > "$file" fi