MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getList

Method getList

src/Savegame/SavedGame.cpp:161–207  ·  view source on GitHub ↗

* Gets all the info of the saves found in the user folder. * @param lang Loaded language. * @param autoquick Include autosaves and quicksaves. * @return List of saves info. */

Source from the content-addressed store, hash-verified

159 * @return List of saves info.
160 */
161std::vector<SaveInfo> SavedGame::getList(Language *lang, bool autoquick)
162{
163 std::vector<SaveInfo> info;
164
165 if (autoquick)
166 {
167 std::vector<std::string> saves = CrossPlatform::getFolderContents(Options::getUserFolder(), "asav");
168 for (std::vector<std::string>::iterator i = saves.begin(); i != saves.end(); ++i)
169 {
170 try
171 {
172 info.push_back(getSaveInfo(*i, lang));
173 }
174 catch (Exception &e)
175 {
176 Log(LOG_ERROR) << e.what();
177 continue;
178 }
179 catch (YAML::Exception &e)
180 {
181 Log(LOG_ERROR) << e.what();
182 continue;
183 }
184 }
185 }
186
187 std::vector<std::string> saves = CrossPlatform::getFolderContents(Options::getUserFolder(), "sav");
188 for (std::vector<std::string>::iterator i = saves.begin(); i != saves.end(); ++i)
189 {
190 try
191 {
192 info.push_back(getSaveInfo(*i, lang));
193 }
194 catch (Exception &e)
195 {
196 Log(LOG_ERROR) << e.what();
197 continue;
198 }
199 catch (YAML::Exception &e)
200 {
201 Log(LOG_ERROR) << e.what();
202 continue;
203 }
204 }
205
206 return info;
207}
208
209/**
210 * Gets the info of a specific save file.

Callers

nothing calls this directly

Calls 3

getFolderContentsFunction · 0.85
getUserFolderFunction · 0.85
whatMethod · 0.80

Tested by

no test coverage detected