mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
[cmdpal] Fix "copy file path" function in file search extension (#38077)
The original code not work. It will throw com exception. I prefer to use ClipboardHelper one. ----- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
using Microsoft.CmdPal.Ext.Indexer.Data;
|
||||
using Microsoft.CmdPal.Ext.Indexer.Properties;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using Windows.ApplicationModel.DataTransfer;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Indexer.Commands;
|
||||
|
||||
@@ -24,10 +23,7 @@ internal sealed partial class CopyPathCommand : InvokableCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataPackage = new DataPackage();
|
||||
dataPackage.SetText(_item.FullPath);
|
||||
Clipboard.SetContent(dataPackage);
|
||||
Clipboard.Flush();
|
||||
ClipboardHelper.SetText(_item.FullPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user