Merge branch 'Tryibion-nameof-module-add'

This commit is contained in:
Wojtek Figat
2024-08-28 16:39:44 +02:00
3 changed files with 6 additions and 6 deletions

View File

@@ -261,7 +261,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (!file.Contains("GameProjectTarget")) if (!file.Contains("GameProjectTarget"))
continue; // Skip continue; // Skip
if (file.Contains("Modules.Add(\"Game\")")) if (file.Contains("Modules.Add(\"Game\")") || file.Contains("Modules.Add(nameof(Game))"))
{ {
// Assume Game represents the main game module // Assume Game represents the main game module
moduleName = "Game"; moduleName = "Game";

View File

@@ -226,7 +226,7 @@ bool Editor::CheckProjectUpgrade()
" base.Init();\n" " base.Init();\n"
"\n" "\n"
" // Reference the modules for game\n" " // Reference the modules for game\n"
" Modules.Add(\"{0}\");\n" " Modules.Add(nameof({0}));\n"
" }}\n" " }}\n"
"}}\n" "}}\n"
), codeName), Encoding::UTF8); ), codeName), Encoding::UTF8);
@@ -242,7 +242,7 @@ bool Editor::CheckProjectUpgrade()
" base.Init();\n" " base.Init();\n"
"\n" "\n"
" // Reference the modules for editor\n" " // Reference the modules for editor\n"
" Modules.Add(\"{0}\");\n" " Modules.Add(nameof({0}));\n"
"{1}" "{1}"
" }}\n" " }}\n"
"}}\n" "}}\n"
@@ -476,7 +476,7 @@ int32 Editor::LoadProduct()
" base.Init();\n" " base.Init();\n"
"\n" "\n"
" // Reference the modules for game\n" " // Reference the modules for game\n"
" Modules.Add(\"Game\");\n" " Modules.Add(nameof(Game));\n"
" }\n" " }\n"
"}\n"), Encoding::UTF8); "}\n"), Encoding::UTF8);
failed |= File::WriteAllText(projectPath / TEXT("Source/GameEditorTarget.Build.cs"),TEXT( failed |= File::WriteAllText(projectPath / TEXT("Source/GameEditorTarget.Build.cs"),TEXT(
@@ -490,7 +490,7 @@ int32 Editor::LoadProduct()
" base.Init();\n" " base.Init();\n"
"\n" "\n"
" // Reference the modules for editor\n" " // Reference the modules for editor\n"
" Modules.Add(\"Game\");\n" " Modules.Add(nameof(Game));\n"
" }\n" " }\n"
"}\n"), Encoding::UTF8); "}\n"), Encoding::UTF8);
failed |= File::WriteAllText(projectPath / TEXT("Source/Game/Game.Build.cs"),TEXT( failed |= File::WriteAllText(projectPath / TEXT("Source/Game/Game.Build.cs"),TEXT(

View File

@@ -382,7 +382,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
// Get editor target and target files and add module // Get editor target and target files and add module
var files = Directory.GetFiles(path); var files = Directory.GetFiles(path);
var targetModuleText = $"Modules.Add(\"{moduleName}\");\n "; var targetModuleText = $"Modules.Add(nameof({moduleName}));\n ";
foreach (var file in files) foreach (var file in files)
{ {
if (!file.Contains(".Build.cs", StringComparison.OrdinalIgnoreCase)) if (!file.Contains(".Build.cs", StringComparison.OrdinalIgnoreCase))