| 126 | } |
| 127 | |
| 128 | bool RecentBooksStore::loadFromFile() { |
| 129 | // Try JSON first |
| 130 | if (Storage.exists(RECENT_BOOKS_FILE_JSON)) { |
| 131 | String json = Storage.readFile(RECENT_BOOKS_FILE_JSON); |
| 132 | if (!json.isEmpty()) { |
| 133 | return JsonSettingsIO::loadRecentBooks(*this, json.c_str()); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // Fall back to binary migration |
| 138 | if (Storage.exists(RECENT_BOOKS_FILE_BIN)) { |
| 139 | if (loadFromBinaryFile()) { |
| 140 | saveToFile(); |
| 141 | Storage.rename(RECENT_BOOKS_FILE_BIN, RECENT_BOOKS_FILE_BAK); |
| 142 | LOG_DBG("RBS", "Migrated recent.bin to recent.json"); |
| 143 | return true; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | return false; |
| 148 | } |
| 149 | |
| 150 | bool RecentBooksStore::loadFromBinaryFile() { |
| 151 | HalFile inputFile; |