MCPcopy Create free account
hub / github.com/DFHack/dfhack / save

Method save

library/include/Console.h:62–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60 return true;
61 }
62 bool save (std::filesystem::path filename)
63 {
64 if (!history.size())
65 return true;
66 std::ofstream outfile (filename);
67 //fprintf(stderr,"Save: Initialized stream\n");
68 if(outfile.bad())
69 return false;
70 //fprintf(stderr,"Save: Iterating...\n");
71 for(auto iter = history.begin();iter < history.end(); iter++)
72 {
73 //fprintf(stderr,"Save: Dumping %s\n",(*iter).c_str());
74 outfile << *iter << std::endl;
75 //fprintf(stderr,"Save: Flushing\n");
76 outfile.flush();
77 }
78 //fprintf(stderr,"Save: Closing\n");
79 outfile.close();
80 //fprintf(stderr,"Save: Done\n");
81 return true;
82 }
83 /// add a command to the history
84 void add(const std::string& command)
85 {

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected