| 7 | #include "Engine/Platform/FileSystem.h" |
| 8 | |
| 9 | bool ValidateStep::Perform(CookingData& data) |
| 10 | { |
| 11 | data.StepProgress(TEXT("Performing validation"), 0); |
| 12 | |
| 13 | // Ensure output and cache directories exist |
| 14 | if (!FileSystem::DirectoryExists(data.NativeCodeOutputPath) && FileSystem::CreateDirectory(data.NativeCodeOutputPath)) |
| 15 | { |
| 16 | data.Error(TEXT("Failed to create build output directory.")); |
| 17 | return true; |
| 18 | } |
| 19 | if (!FileSystem::DirectoryExists(data.ManagedCodeOutputPath) && FileSystem::CreateDirectory(data.ManagedCodeOutputPath)) |
| 20 | { |
| 21 | data.Error(TEXT("Failed to create build output directory.")); |
| 22 | return true; |
| 23 | } |
| 24 | if (!FileSystem::DirectoryExists(data.DataOutputPath) && FileSystem::CreateDirectory(data.DataOutputPath)) |
| 25 | { |
| 26 | data.Error(TEXT("Failed to create build output directory.")); |
| 27 | return true; |
| 28 | } |
| 29 | if (!FileSystem::DirectoryExists(data.CacheDirectory) && FileSystem::CreateDirectory(data.CacheDirectory)) |
| 30 | { |
| 31 | data.Error(TEXT("Failed to create build cache directory.")); |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | #if OFFICIAL_BUILD |
| 36 | // Validate that platform data is installed |
| 37 | if (!FileSystem::DirectoryExists(data.GetGameBinariesPath())) |
| 38 | { |
| 39 | data.Error(TEXT("Missing platform data tools for the target platform. Use Flax Launcher and download the required package.")); |
| 40 | return true; |
| 41 | } |
| 42 | #endif |
| 43 | |
| 44 | // Load game settings (may be modified via editor) |
| 45 | if (GameSettings::Load()) |
| 46 | { |
| 47 | data.Error(TEXT("Failed to load game settings.")); |
| 48 | return true; |
| 49 | } |
| 50 | data.AddRootAsset(Globals::ProjectContentFolder / TEXT("GameSettings.json")); |
| 51 | |
| 52 | // Validate game settings |
| 53 | auto gameSettings = GameSettings::Get(); |
| 54 | if (gameSettings == nullptr) |
| 55 | { |
| 56 | data.Error(TEXT("Missing game settings.")); |
| 57 | return true; |
| 58 | } |
| 59 | { |
| 60 | if (gameSettings->ProductName.IsEmpty()) |
| 61 | { |
| 62 | data.Error(TEXT("Missing product name.")); |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | if (gameSettings->CompanyName.IsEmpty()) |
no test coverage detected