| 9795 | } |
| 9796 | |
| 9797 | bool BfCompiler::WriteEmitData(const StringImpl& filePath, BfProject* project) |
| 9798 | { |
| 9799 | ZipFile zipFile; |
| 9800 | |
| 9801 | for (auto type : mContext->mResolvedTypes) |
| 9802 | { |
| 9803 | auto typeInst = type->ToTypeInstance(); |
| 9804 | if (typeInst == NULL) |
| 9805 | continue; |
| 9806 | if (typeInst->mTypeDef->mEmitParent == NULL) |
| 9807 | continue; |
| 9808 | if (!project->ContainsReference(typeInst->mTypeDef->mProject)) |
| 9809 | continue; |
| 9810 | |
| 9811 | auto bfParser = typeInst->mTypeDef->GetLastSource()->ToParser(); |
| 9812 | String name = bfParser->mFileName; |
| 9813 | if (name.StartsWith("$Emit$")) |
| 9814 | name.Remove(0, 6); |
| 9815 | String path = EncodeFileName(name); |
| 9816 | path.Append(".bf"); |
| 9817 | |
| 9818 | if (!zipFile.IsOpen()) |
| 9819 | { |
| 9820 | if (!zipFile.Create(filePath)) |
| 9821 | return false; |
| 9822 | } |
| 9823 | |
| 9824 | zipFile.Add(path, Span<uint8>((uint8*)bfParser->mSrc, bfParser->mSrcLength)); |
| 9825 | } |
| 9826 | |
| 9827 | if (zipFile.IsOpen()) |
| 9828 | return zipFile.Close(); |
| 9829 | |
| 9830 | return true; |
| 9831 | } |
| 9832 | |
| 9833 | ////////////////////////////////////////////////////////////////////////// |
| 9834 |
no test coverage detected