| 274 | } |
| 275 | |
| 276 | bool MifareKeysManager::appendToFS(FS *fs, const char *fsName, const String &key) { |
| 277 | if (!fs->exists(KEYS_DIR)) { fs->mkdir(KEYS_DIR); } |
| 278 | |
| 279 | if (!fs->exists(KEYS_PATH)) { |
| 280 | log_i("File missing on %s, creating", fsName); |
| 281 | // Need to create full file - will be done by caller |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | File file = fs->open(KEYS_PATH, FILE_APPEND); |
| 286 | if (!file) { |
| 287 | log_w("Failed to append to %s", fsName); |
| 288 | return false; |
| 289 | } |
| 290 | |
| 291 | file.println(key); |
| 292 | file.close(); |
| 293 | return true; |
| 294 | } |