| 359 | } |
| 360 | |
| 361 | bool FileFinder::OpenViewToEasyRpgFile(FilesystemView& fs) { |
| 362 | auto files = fs.ListDirectory(); |
| 363 | if (!files) { |
| 364 | return false; |
| 365 | } |
| 366 | |
| 367 | int items = 0; |
| 368 | std::string filename; |
| 369 | |
| 370 | for (auto& file : *files) { |
| 371 | if (EndsWith(file.second.name, ".easyrpg")) { |
| 372 | ++items; |
| 373 | if (items == 2) { |
| 374 | // Contains more than one game |
| 375 | return false; |
| 376 | } |
| 377 | filename = file.second.name; |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | if (filename.empty()) { |
| 382 | return false; |
| 383 | } |
| 384 | |
| 385 | // One candidate to check |
| 386 | auto ep_fs = fs.Create(filename); |
| 387 | if (FileFinder::IsValidProject(ep_fs)) { |
| 388 | fs = ep_fs; |
| 389 | return true; |
| 390 | } else { |
| 391 | return false; |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | bool FileFinder::HasSavegame() { |
| 396 | return GetSavegames() > 0; |
nothing calls this directly
no test coverage detected