mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
* Add log to trace error for apps. * Add bookmark log * registry exception log * fix * Added logger for cmdpal extensions. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * remove noise * Update Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * change log level * change level * Fix comments * Fixed comments. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * Resolve comments Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> --------- Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> Co-authored-by: Shawn Yuan <shuaiyuan@microsoft.com>
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using ManagedCommon;
|
|
using Microsoft.CmdPal.Ext.Bookmarks.Properties;
|
|
using Microsoft.CommandPalette.Extensions;
|
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
|
|
|
namespace Microsoft.CmdPal.Ext.Bookmarks;
|
|
|
|
internal sealed partial class OpenInTerminalCommand : InvokableCommand
|
|
{
|
|
private readonly string _folder;
|
|
|
|
public OpenInTerminalCommand(string folder)
|
|
{
|
|
Name = Resources.bookmarks_open_in_terminal_name;
|
|
_folder = folder;
|
|
}
|
|
|
|
public override ICommandResult Invoke()
|
|
{
|
|
try
|
|
{
|
|
// Start Windows Terminal with the specified folder
|
|
var startInfo = new System.Diagnostics.ProcessStartInfo
|
|
{
|
|
FileName = "wt.exe",
|
|
Arguments = $"-d \"{_folder}\"",
|
|
UseShellExecute = true,
|
|
};
|
|
System.Diagnostics.Process.Start(startInfo);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.LogError(ex.Message);
|
|
}
|
|
|
|
return CommandResult.Dismiss();
|
|
}
|
|
}
|