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

Method migrateLanguageBinaryFile

src/CrossPointSettings.cpp:141–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool CrossPointSettings::migrateLanguageBinaryFile() {
142 // V1_LANGUAGES / V1_LANGUAGE_COUNT are emitted by gen_i18n.py with the
143 // frozen enum order from 2f969a9.
144 if (!Storage.exists(LANG_FILE_BIN)) return false;
145
146 HalFile f;
147 if (Storage.openFileForRead("CPS", LANG_FILE_BIN, f)) {
148 uint8_t version;
149 serialization::readPod(f, version);
150 if (version == 1) {
151 uint8_t oldIndex;
152 serialization::readPod(f, oldIndex);
153 if (oldIndex < V1_LANGUAGE_COUNT) {
154 language = static_cast<uint8_t>(V1_LANGUAGES[oldIndex]);
155 }
156 }
157 }
158 Storage.rename(LANG_FILE_BIN, LANG_FILE_BAK);
159 saveToFile();
160 LOG_DBG("CPS", "Migrated language.bin into settings.json");
161 return true;
162}
163
164bool CrossPointSettings::loadFromBinaryFile() {
165 HalFile inputFile;

Callers

nothing calls this directly

Calls 4

readPodFunction · 0.85
existsMethod · 0.80
openFileForReadMethod · 0.80
renameMethod · 0.80

Tested by

no test coverage detected