Add button to open the msbuild logs folder

This commit is contained in:
Paul Joannon 2023-01-25 11:51:51 +01:00
parent e51a20b714
commit 7cf42dbdee
No known key found for this signature in database
GPG key ID: C12F69B0AD0390DD
3 changed files with 29 additions and 2 deletions

View file

@ -22,8 +22,7 @@ namespace GodotTools.Build
// TODO Use List once we have proper serialization
public Godot.Collections.Array CustomProperties { get; private set; } = new();
public string LogsDirPath =>
Path.Combine(GodotSharpDirs.BuildLogsDirs, $"{Solution.Md5Text()}_{Configuration}");
public string LogsDirPath => GodotSharpDirs.LogsDirPathFor(Solution, Configuration);
public override bool Equals(object? obj)
{

View file

@ -1,4 +1,5 @@
using System;
using System.IO;
using Godot;
using GodotTools.Internals;
using static GodotTools.Internals.Globals;
@ -14,6 +15,7 @@ namespace GodotTools.Build
private Button _errorsBtn;
private Button _warningsBtn;
private Button _viewLogBtn;
private Button _openLogsFolderBtn;
private void WarningsToggled(bool pressed)
{
@ -93,6 +95,10 @@ namespace GodotTools.Build
private void ViewLogToggled(bool pressed) => BuildOutputView.LogVisible = pressed;
private void OpenLogsFolderPressed() => OS.ShellOpen(
$"file://{GodotSharpDirs.LogsDirPathFor("Debug")}"
);
private void BuildMenuOptionPressed(long id)
{
switch ((BuildMenuOptions)id)
@ -171,6 +177,22 @@ namespace GodotTools.Build
_viewLogBtn.Toggled += ViewLogToggled;
toolBarHBox.AddChild(_viewLogBtn);
// Horizontal spacer, push everything to the right.
toolBarHBox.AddChild(new Control
{
SizeFlagsHorizontal = SizeFlags.ExpandFill,
});
_openLogsFolderBtn = new Button
{
Text = "Show Logs in File Manager".TTR(),
Icon = GetThemeIcon("Filesystem", "EditorIcons"),
ExpandIcon = false,
FocusMode = FocusModeEnum.None,
};
_openLogsFolderBtn.Pressed += OpenLogsFolderPressed;
toolBarHBox.AddChild(_openLogsFolderBtn);
BuildOutputView = new BuildOutputView();
AddChild(BuildOutputView);
}

View file

@ -115,5 +115,11 @@ namespace GodotTools.Internals
return _projectCsProjPath;
}
}
public static string LogsDirPathFor(string solution, string configuration)
=> Path.Combine(BuildLogsDirs, $"{solution.Md5Text()}_{configuration}");
public static string LogsDirPathFor(string configuration)
=> LogsDirPathFor(ProjectSlnPath, configuration);
}
}