MCPcopy Create free account
hub / github.com/beefytech/Beef / Finish

Method Finish

IDEHelper/Backend/BeLibManger.cpp:208–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208bool BeLibFile::Finish()
209{
210 BP_ZONE("BeLibFile::Finish");
211
212 //mOldEntries.clear();
213
214 Dictionary<String, BeLibEntry*>* libEntryMaps[2] = { &mEntries, &mOldEntries };
215
216 Array<BeLibEntry*> libEntries;
217
218 bool isAllReferenced = true;
219 for (auto entryMap : libEntryMaps)
220 {
221 for (auto& libEntryPair : *entryMap)
222 {
223 auto libEntry = libEntryPair.mValue;
224 if (libEntry->mReferenced)
225 libEntries.push_back(libEntry);
226 else
227 isAllReferenced = false;
228 }
229 }
230
231 if ((isAllReferenced) && (mEntries.IsEmpty()) && (mOldFileStream.IsOpen()))
232 {
233 mOldFileStream.Close();
234 String altName = mFilePath + "_";
235 if (::MoveFileA(altName.c_str(), mFilePath.c_str()))
236 {
237 return true; // There are no changes
238 }
239 }
240
241 if (!mFileStream.Open(mFilePath, "wb"))
242 {
243 mFailed = true;
244 return false;
245 }
246
247 if ((!mOldEntries.IsEmpty()) && (!mOldFileStream.IsOpen()))
248 {
249 // We failed to open the old stream but we still had old entries to references..
250 mFailed = true;
251 return false;
252 }
253
254 mFileStream.Write("!<arch>\n", 8);
255
256 std::sort(libEntries.begin(), libEntries.end(),
257 [&](BeLibEntry* lhs, BeLibEntry* rhs)
258 {
259 return lhs->mName < rhs->mName;
260 });
261
262 int longNamesSize = 0;
263
264 int tabSize = 4; // num symbols
265 int numSymbols = 0;

Callers

nothing calls this directly

Calls 15

ToBigEndianFunction · 0.85
push_backMethod · 0.45
IsEmptyMethod · 0.45
IsOpenMethod · 0.45
CloseMethod · 0.45
c_strMethod · 0.45
OpenMethod · 0.45
WriteMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lengthMethod · 0.45
GetPosMethod · 0.45

Tested by

no test coverage detected