MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / loadFromFile

Method loadFromFile

src/RecentBooksStore.cpp:128–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128bool 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
150bool RecentBooksStore::loadFromBinaryFile() {
151 HalFile inputFile;

Callers

nothing calls this directly

Calls 4

existsMethod · 0.80
readFileMethod · 0.80
renameMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected