1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-03 14:56:01 +02:00

Added an open in terminal dialogue

This commit is contained in:
Booklordofthedings 2024-07-16 12:49:15 +02:00
parent efb1a9c350
commit 8f7287b3dc
5 changed files with 69 additions and 0 deletions

View file

@ -132,6 +132,7 @@ namespace IDE.ui
menu.AddItem("Open").mOnMenuItemSelected.Add(new (menu) => { TryOpenWorkspace(); });
menu.AddItem();
menu.AddItem("Open Containing Folder").mOnMenuItemSelected.Add(new (menu) => { OpenContainingFolder(); });
menu.AddItem("Open in Terminal").mOnMenuItemSelected.Add(new (menu) => { OpenInTerminal(); });
menu.AddItem("Copy Path").mOnMenuItemSelected.Add(new (menu) => {
gApp.SetClipboardData("text", mPath.CStr(), (int32)mPath.Length + 1, true);
});
@ -174,6 +175,23 @@ namespace IDE.ui
process.Start(psi).IgnoreError();
}
void OpenInTerminal()
{
if (!Directory.Exists(mPath))
{
ShowNotFoundDialog();
return;
}
ProcessStartInfo psi = scope ProcessStartInfo();
psi.SetFileName(gApp.mSettings.mEditorSettings.mDefaultConsole);
psi.UseShellExecute = true;
psi.SetWorkingDirectory(mPath);
var process = scope SpawnedProcess();
process.Start(psi).IgnoreError();
}
void TryOpenWorkspace()
{
const String WORKSPACE_FILENAME = "BeefSpace.toml";