| 48 | #define MAIN_SAVES_FOLDER_STR "saves" |
| 49 | |
| 50 | FileSelectScreen::FileSelectScreen(MainProgram& m): Screen(m) { |
| 51 | savePath = main.conf.configPath / MAIN_SAVES_FOLDER_STR; |
| 52 | trashPath = main.conf.configPath / "trash"; |
| 53 | infoPath = main.conf.configPath / "fileSelectInfo.json"; |
| 54 | |
| 55 | SDL_CreateDirectory(savePath.string().c_str()); |
| 56 | SDL_CreateDirectory(trashPath.string().c_str()); |
| 57 | |
| 58 | try { |
| 59 | nlohmann::json j(nlohmann::json::parse(read_file_to_string(infoPath))); |
| 60 | j.get_to(saveInfo); |
| 61 | } |
| 62 | catch(...) {} |
| 63 | |
| 64 | update_file_list(fileList, savePath, false); |
| 65 | |
| 66 | // Update trash list once to get trash info up to date |
| 67 | std::vector<FileInfo> trashListTemp; |
| 68 | update_file_list(trashListTemp, trashPath, true); |
| 69 | } |
| 70 | |
| 71 | void FileSelectScreen::update() { |
| 72 | std::erase_if(main.logMessages, [&](auto& logM) { |
nothing calls this directly
no test coverage detected