1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-22 08:10:07 +00:00

vscode: fix creation of storage.json file (#6650)

Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com>
This commit is contained in:
Reputable2772 2025-03-18 19:14:38 +05:30 committed by GitHub
parent c657142e24
commit fb74bb76d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -299,15 +299,15 @@ in {
pkgs.writeShellScript "vscode-global-storage-modify" ''
PATH=${makeBinPath [ pkgs.jq ]}''${PATH:+:}$PATH
file="${userDir}/globalStorage/storage.json"
if [ -f "$file" ]; then
existing_profiles=$(jq '.userDataProfiles // [] | map({ (.name): .location }) | add // {}' "$file")
file_write=""
profiles=(${
escapeShellArgs
(flatten (mapAttrsToList (n: v: n) allProfilesExceptDefault))
})
if [ -f "$file" ]; then
existing_profiles=$(jq '.userDataProfiles // [] | map({ (.name): .location }) | add // {}' "$file")
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
file_write="$file_write$([ "$file_write" != "" ] && echo "...")$profile"
@ -318,6 +318,7 @@ in {
file_write="$file_write$([ "$file_write" != "" ] && echo "...")$profile"
done
mkdir -p $(dirname "$file")
echo "{}" > "$file"
fi