From 8f76fe40498c014318d22f45c3ce644544eeeaa6 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Fri, 9 Jun 2023 22:14:33 -0400 Subject: [PATCH] don't let rename source/content folders --- Source/Editor/Content/Items/ContentFolder.cs | 11 ++++++++++- Source/Editor/ProjectInfo.cs | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Content/Items/ContentFolder.cs b/Source/Editor/Content/Items/ContentFolder.cs index 86c374fee..f3c698782 100644 --- a/Source/Editor/Content/Items/ContentFolder.cs +++ b/Source/Editor/Content/Items/ContentFolder.cs @@ -113,7 +113,16 @@ namespace FlaxEditor.Content public override ContentItemSearchFilter SearchFilter => ContentItemSearchFilter.Other; /// - 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; + } + } /// public override bool CanDrag => ParentFolder != null; // Deny rename action for root folders diff --git a/Source/Editor/ProjectInfo.cs b/Source/Editor/ProjectInfo.cs index bc55a9c05..62402b0d8 100644 --- a/Source/Editor/ProjectInfo.cs +++ b/Source/Editor/ProjectInfo.cs @@ -55,6 +55,16 @@ namespace FlaxEditor [NonSerialized] public string ProjectFolderPath; + /// + /// The content assets folder + /// + public string ContentFolderPath; + + /// + /// The source files folder path + /// + public string SourceFolderPath; + /// /// The project version. /// @@ -157,6 +167,8 @@ namespace FlaxEditor var project = JsonConvert.DeserializeObject(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))