don't let rename source/content folders

This commit is contained in:
Ruan Lucas
2023-06-09 22:14:33 -04:00
parent f345e0dffc
commit 8f76fe4049
2 changed files with 22 additions and 1 deletions

View File

@@ -113,7 +113,16 @@ namespace FlaxEditor.Content
public override ContentItemSearchFilter SearchFilter => ContentItemSearchFilter.Other;
/// <inheritdoc />
public override bool CanRename => ParentFolder != null; // Deny rename action for root folders
public override bool CanRename
{
get
{
var hasParentFolder = ParentFolder != null;
var isContentFolder = IsFolder && Path == Editor.Instance.GameProject.ContentFolderPath;
var isSourceFolder = IsFolder && Path == Editor.Instance.GameProject.SourceFolderPath;
return hasParentFolder && !isContentFolder && !isSourceFolder;
}
}
/// <inheritdoc />
public override bool CanDrag => ParentFolder != null; // Deny rename action for root folders

View File

@@ -55,6 +55,16 @@ namespace FlaxEditor
[NonSerialized]
public string ProjectFolderPath;
/// <summary>
/// The content assets folder
/// </summary>
public string ContentFolderPath;
/// <summary>
/// The source files folder path
/// </summary>
public string SourceFolderPath;
/// <summary>
/// The project version.
/// </summary>
@@ -157,6 +167,8 @@ namespace FlaxEditor
var project = JsonConvert.DeserializeObject<ProjectInfo>(contents);
project.ProjectPath = path;
project.ProjectFolderPath = StringUtils.NormalizePath(Path.GetDirectoryName(path));
project.ContentFolderPath = StringUtils.NormalizePath(project.ProjectFolderPath + "/Content");
project.SourceFolderPath = StringUtils.NormalizePath(project.ProjectFolderPath + "/Source");
// Process project data
if (string.IsNullOrEmpty(project.Name))