| 942 | } |
| 943 | |
| 944 | bool Add(CookingData& data, AssetsCache::Entry& entry, const String& sourcePath) |
| 945 | { |
| 946 | const uint64 size = FileSystem::GetFileSize(sourcePath); |
| 947 | |
| 948 | // Check if this will step out of the limit |
| 949 | if (addedEntries.Count() + 1 > MaxAssetsPerPackage || (bytesAdded + size) > MaxPackageSize) |
| 950 | { |
| 951 | if (Package(data)) |
| 952 | return true; |
| 953 | } |
| 954 | |
| 955 | // Add |
| 956 | addedEntries.Add(&entry); |
| 957 | bytesAdded += size; |
| 958 | |
| 959 | // Gather the asset to package it later |
| 960 | auto file = New<FlaxFile>(sourcePath); |
| 961 | if (file->Load()) |
| 962 | { |
| 963 | Delete(file); |
| 964 | data.Error(TEXT("Failed to load cooked asset.")); |
| 965 | return true; |
| 966 | } |
| 967 | files.Add(file); |
| 968 | |
| 969 | return false; |
| 970 | } |
| 971 | |
| 972 | bool Package(CookingData& data) |
| 973 | { |
no test coverage detected