Refactor folder structure

This commit is contained in:
2026-02-18 00:50:46 +09:00
parent 426786397c
commit db8ca971a8
413 changed files with 2885 additions and 3634 deletions

View File

@@ -0,0 +1,53 @@
using Ghost.Editor.Core;
namespace Ghost.Editor.View.Controls;
internal partial class ProjectBrowser
{
[ContextMenuItem("project-browser", "Show in Explorer")]
private static void ShowInExplorer()
{
var path = LastFocused?.ViewModel.CurrentDirectoryPath;
if (!Directory.Exists(path))
{
return;
}
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
{
FileName = path,
UseShellExecute = true,
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);
}
}