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:
parent
c657142e24
commit
fb74bb76d9
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue