MCPcopy Create free account
hub / github.com/devosoft/avida / LoadAttachment

Method LoadAttachment

avida-core/source/viewer/Freezer.cc:3292–3311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3290}
3291
3292Apto::String Avida::Viewer::Freezer::LoadAttachment(FreezerID entry_id, const Apto::String& name)
3293{
3294 if (!IsValid(entry_id) || entry_id.type == GENOME) return "";
3295
3296 Apto::String rtn;
3297 Apto::String name_path = Apto::FileSystem::PathAppend(PathOf(entry_id), name);
3298 if (Apto::FileSystem::IsFile(name_path)) {
3299 // Open name file and read contents
3300 cFile file;
3301 file.Open((const char*)name_path, std::ios::in);
3302 cString line;
3303 if (!file.Eof() && file.ReadLine(line)) rtn = line;
3304 while (!file.Eof() && file.ReadLine(line)) {
3305 rtn += "\n";
3306 rtn += line;
3307 }
3308 file.Close();
3309 }
3310 return rtn;
3311}
3312
3313
3314

Callers

nothing calls this directly

Calls 4

OpenMethod · 0.80
EofMethod · 0.80
ReadLineMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected