diff --git a/Source/Editor/Content/Tree/ContentTreeNode.cs b/Source/Editor/Content/Tree/ContentTreeNode.cs
index 7df407e08..07ce7f803 100644
--- a/Source/Editor/Content/Tree/ContentTreeNode.cs
+++ b/Source/Editor/Content/Tree/ContentTreeNode.cs
@@ -295,7 +295,8 @@ namespace FlaxEditor.Content
StartRenaming();
return true;
case KeyboardKeys.Delete:
- Editor.Instance.Windows.ContentWin.Delete(Folder);
+ if(Folder.Exists)
+ Editor.Instance.Windows.ContentWin.Delete(Folder);
return true;
}
if (RootWindow.GetKey(KeyboardKeys.Control))
@@ -303,7 +304,8 @@ namespace FlaxEditor.Content
switch (key)
{
case KeyboardKeys.D:
- Editor.Instance.Windows.ContentWin.Duplicate(Folder);
+ if(Folder.Exists)
+ Editor.Instance.Windows.ContentWin.Duplicate(Folder);
return true;
}
}
diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs
index 66ed50daf..145c0d972 100644
--- a/Source/Editor/Windows/ContentWindow.cs
+++ b/Source/Editor/Windows/ContentWindow.cs
@@ -396,7 +396,7 @@ namespace FlaxEditor.Windows
/// The item to delete.
public void Delete(ContentItem item)
{
- Delete(new List { item });
+ Delete(new List(1) { item });
}
///
@@ -405,36 +405,18 @@ namespace FlaxEditor.Windows
/// The items to delete.
public void Delete(List items)
{
+ if (items.Count == 0) return;
+
// TODO: remove items that depend on different items in the list: use wants to remove `folderA` and `folderA/asset.x`, we should just remove `folderA`
var toDelete = new List(items);
+ string msg = toDelete.Count == 1 ?
+ string.Format("Are you sure to delete \'{0}\'?\nThis action cannot be undone. Files will be deleted permanently.", items[0].Path)
+ : string.Format("Are you sure to delete {0} selected items?\nThis action cannot be undone. Files will be deleted permanently.", items.Count);
+
// Ask user
- if (toDelete.Count == 1)
- {
- // Single item
- if (MessageBox.Show(string.Format("Are you sure to delete \'{0}\'?\nThis action cannot be undone. Files will be deleted permanently.", items[0].Path),
- "Delete asset(s)",
- MessageBoxButtons.OKCancel,
- MessageBoxIcon.Question)
- != DialogResult.OK)
- {
- // Break
- return;
- }
- }
- else
- {
- // Many items
- if (MessageBox.Show(string.Format("Are you sure to delete {0} selected items?\nThis action cannot be undone. Files will be deleted permanently.", items.Count),
- "Delete asset(s)",
- MessageBoxButtons.OKCancel,
- MessageBoxIcon.Question)
- != DialogResult.OK)
- {
- // Break
- return;
- }
- }
+ if (MessageBox.Show(msg, "Delete asset(s)", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
+ return;
// Clear navigation
// TODO: just remove invalid locations from the history (those are removed)