From bd32619016bc58dd7eb06d08ac61f52fb4c1e6d2 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 1 Oct 2023 21:11:08 -0500 Subject: [PATCH] Small fix --- Source/Editor/Windows/ContentWindow.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index 4169f60d3..890f4f770 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -740,9 +740,6 @@ namespace FlaxEditor.Windows Editor.LogWarning("Failed to create module due to no name"); return; } - - var sourceFolder = SelectedNode.Folder; - var sourcePath = sourceFolder.Path; // Create folder var moduleFolderPath = Path.Combine(path, moduleName); @@ -782,7 +779,7 @@ namespace FlaxEditor.Windows Editor.Log($"Module created at {modulePath}"); // Get editor target and target files and add module - var files = Directory.GetFiles(sourceFolder.Path); + var files = Directory.GetFiles(path); var targetModuleText = $"Modules.Add(\"{moduleName}\");\n "; foreach (var file in files) { @@ -791,9 +788,10 @@ namespace FlaxEditor.Windows var targetText = await File.ReadAllTextAsync(file); - if (!editorModule && targetText.Contains("GameProjectTarget", StringComparison.Ordinal)) + // Skip game project if it is suppose to be an editor module + if (editorModule && targetText.Contains("GameProjectTarget", StringComparison.Ordinal)) continue; - + // TODO: Handle edge case when there are no modules in a target var index = targetText.IndexOf("Modules.Add"); if (index != -1)