Skip to content

Commit 7575c04

Browse files
moooyoYu Leng (from Dev Box)
and
Yu Leng (from Dev Box)
authored
[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) <[email protected]>
1 parent e52dd68 commit 7575c04

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/CopyPathCommand.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Microsoft.CmdPal.Ext.Indexer.Data;
66
using Microsoft.CmdPal.Ext.Indexer.Properties;
77
using Microsoft.CommandPalette.Extensions.Toolkit;
8-
using Windows.ApplicationModel.DataTransfer;
98

109
namespace Microsoft.CmdPal.Ext.Indexer.Commands;
1110

@@ -24,10 +23,7 @@ public override CommandResult Invoke()
2423
{
2524
try
2625
{
27-
var dataPackage = new DataPackage();
28-
dataPackage.SetText(_item.FullPath);
29-
Clipboard.SetContent(dataPackage);
30-
Clipboard.Flush();
26+
ClipboardHelper.SetText(_item.FullPath);
3127
}
3228
catch
3329
{

0 commit comments

Comments
 (0)