forked from Misaki/GhostEngine
Update ContextFlyout
This commit is contained in:
@@ -20,4 +20,34 @@ internal partial class ProjectBrowser
|
||||
Verb = "open"
|
||||
});
|
||||
}
|
||||
|
||||
[ContextMenuItem("project-browser", "Create/Folder")]
|
||||
private static void CreateFolder()
|
||||
{
|
||||
// TODO: Use AssetService
|
||||
|
||||
var viewModel = LastFocused?.ViewModel;
|
||||
if (viewModel is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var currentDir = viewModel.CurrentDirectoryPath;
|
||||
if (!Directory.Exists(currentDir))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newFolderPath = Path.Combine(currentDir, "New Folder");
|
||||
var folderIndex = 1;
|
||||
while (Directory.Exists(newFolderPath))
|
||||
{
|
||||
newFolderPath = Path.Combine(currentDir, $"New Folder ({folderIndex})");
|
||||
folderIndex++;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(newFolderPath);
|
||||
// Refresh the view model to show the new folder
|
||||
viewModel.NavigateToDirectory(currentDir);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user