mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
CmdPal: hotfix loading packaged apps (#40310)
Regressed in #39678 This block of code just moved up too far. It needs to be after the first attempt to load the resource. closes: did we even file it yet ## Validation Steps Performed  
This commit is contained in:
@@ -6,8 +6,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO.Abstractions;
|
using System.IO.Abstractions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
using Microsoft.CmdPal.Ext.Apps.Commands;
|
using Microsoft.CmdPal.Ext.Apps.Commands;
|
||||||
@@ -15,7 +13,6 @@ using Microsoft.CmdPal.Ext.Apps.Properties;
|
|||||||
using Microsoft.CmdPal.Ext.Apps.Utils;
|
using Microsoft.CmdPal.Ext.Apps.Utils;
|
||||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
using Windows.Win32;
|
using Windows.Win32;
|
||||||
using Windows.Win32.Foundation;
|
|
||||||
using Windows.Win32.Storage.Packaging.Appx;
|
using Windows.Win32.Storage.Packaging.Appx;
|
||||||
using PackageVersion = Microsoft.CmdPal.Ext.Apps.Programs.UWP.PackageVersion;
|
using PackageVersion = Microsoft.CmdPal.Ext.Apps.Programs.UWP.PackageVersion;
|
||||||
using Theme = Microsoft.CmdPal.Ext.Apps.Utils.Theme;
|
using Theme = Microsoft.CmdPal.Ext.Apps.Utils.Theme;
|
||||||
@@ -74,7 +71,7 @@ public class UWPApplication : IProgram
|
|||||||
|
|
||||||
public List<CommandContextItem> GetCommands()
|
public List<CommandContextItem> GetCommands()
|
||||||
{
|
{
|
||||||
List<CommandContextItem> commands = new List<CommandContextItem>();
|
List<CommandContextItem> commands = [];
|
||||||
|
|
||||||
if (CanRunElevated)
|
if (CanRunElevated)
|
||||||
{
|
{
|
||||||
@@ -226,6 +223,16 @@ public class UWPApplication : IProgram
|
|||||||
parsedFallback = prefix + "///" + key;
|
parsedFallback = prefix + "///" + key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Span<char> outBuffer = stackalloc char[1024];
|
||||||
|
var source = $"@{{{packageFullName}? {parsed}}}";
|
||||||
|
|
||||||
|
var loaded = TryLoadIndirectString(source, outBuffer, resourceReference);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(loaded))
|
||||||
|
{
|
||||||
|
return loaded;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(parsedFallback))
|
if (string.IsNullOrEmpty(parsedFallback))
|
||||||
{
|
{
|
||||||
// https://github.com/Wox-launcher/Wox/issues/964
|
// https://github.com/Wox-launcher/Wox/issues/964
|
||||||
@@ -237,16 +244,6 @@ public class UWPApplication : IProgram
|
|||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
Span<char> outBuffer = stackalloc char[1024];
|
|
||||||
var source = $"@{{{packageFullName}? {parsed}}}";
|
|
||||||
|
|
||||||
var loaded = TryLoadIndirectString(source, outBuffer, resourceReference);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(loaded))
|
|
||||||
{
|
|
||||||
return loaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sourceFallback = $"@{{{packageFullName}?{parsedFallback}}}";
|
var sourceFallback = $"@{{{packageFullName}?{parsedFallback}}}";
|
||||||
return TryLoadIndirectString(sourceFallback, outBuffer, $"{resourceReference} (fallback)");
|
return TryLoadIndirectString(sourceFallback, outBuffer, $"{resourceReference} (fallback)");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user