mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[PTRun][Terminal]Array settings parsing (#17707)
This commit is contained in:
committed by
GitHub
parent
a5323b75d9
commit
e530968a9a
@@ -35,15 +35,22 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsTerminal.Helpers
|
||||
};
|
||||
|
||||
var json = JsonDocument.Parse(settingsJson, options);
|
||||
JsonElement profilesList;
|
||||
|
||||
json.RootElement.TryGetProperty("profiles", out JsonElement profilesElement);
|
||||
if (profilesElement.ValueKind != JsonValueKind.Object)
|
||||
if (profilesElement.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
return profiles;
|
||||
profilesElement.TryGetProperty("list", out profilesList);
|
||||
if (profilesList.ValueKind != JsonValueKind.Array)
|
||||
{
|
||||
return profiles;
|
||||
}
|
||||
}
|
||||
|
||||
profilesElement.TryGetProperty("list", out JsonElement profilesList);
|
||||
if (profilesList.ValueKind != JsonValueKind.Array)
|
||||
else if (profilesElement.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
profilesList = profilesElement;
|
||||
}
|
||||
else
|
||||
{
|
||||
return profiles;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,6 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsTerminal.Helpers
|
||||
var settingsPath = Path.Combine(localAppDataPath, "Packages", p.Id.FamilyName, "LocalState", "settings.json");
|
||||
yield return new TerminalPackage(aumid, version, p.DisplayName, settingsPath, p.Logo.LocalPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user