✨ Add folder via dialog
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using SharpIDE.Application.Features.FileWatching;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||
|
||||
namespace SharpIDE.Godot.Features.SolutionExplorer.ContextMenus.Dialogs;
|
||||
@@ -9,6 +10,8 @@ public partial class NewDirectoryDialog : ConfirmationDialog
|
||||
|
||||
public SharpIdeFolder ParentFolder { get; set; } = null!;
|
||||
|
||||
[Inject] private readonly IdeFileOperationsService _ideFileOperationsService = null!;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_nameLineEdit = GetNode<LineEdit>("%DirectoryNameLineEdit");
|
||||
@@ -20,5 +23,15 @@ public partial class NewDirectoryDialog : ConfirmationDialog
|
||||
private void OnConfirmed()
|
||||
{
|
||||
var directoryName = _nameLineEdit.Text.Trim();
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
{
|
||||
GD.PrintErr("Directory name cannot be empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
_ = Task.GodotRun(async () =>
|
||||
{
|
||||
await _ideFileOperationsService.CreateDirectory(ParentFolder, directoryName);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user