mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +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.Data;
|
||||||
using Microsoft.CmdPal.Ext.Indexer.Properties;
|
using Microsoft.CmdPal.Ext.Indexer.Properties;
|
||||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
using Windows.ApplicationModel.DataTransfer;
|
|
||||||
|
|
||||||
namespace Microsoft.CmdPal.Ext.Indexer.Commands;
|
namespace Microsoft.CmdPal.Ext.Indexer.Commands;
|
||||||
|
|
||||||
@@ -24,10 +23,7 @@ internal sealed partial class CopyPathCommand : InvokableCommand
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dataPackage = new DataPackage();
|
ClipboardHelper.SetText(_item.FullPath);
|
||||||
dataPackage.SetText(_item.FullPath);
|
|
||||||
Clipboard.SetContent(dataPackage);
|
|
||||||
Clipboard.Flush();
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user