Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49905dab authored by Katherine Lai's avatar Katherine Lai Committed by Gerrit Code Review
Browse files

Merge "floss: Don't assert when failing to SaveImmediately" into main

parents 838d2564 52afb43e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -123,10 +123,22 @@ void StorageModule::SaveImmediately() {
  }
  // 1. rename old config to backup name
  if (os::FileExists(config_file_path_)) {
#ifndef TARGET_FLOSS
    ASSERT(os::RenameFile(config_file_path_, config_backup_path_));
#else
    if (!os::RenameFile(config_file_path_, config_backup_path_)) {
      LOG_ERROR("Unable to rename old config to back up name");
    }
#endif
  }
  // 2. write in-memory config to disk, if failed, backup can still be used
#ifndef TARGET_FLOSS
  ASSERT(LegacyConfigFile::FromPath(config_file_path_).Write(pimpl_->cache_));
#else
  if (!LegacyConfigFile::FromPath(config_file_path_).Write(pimpl_->cache_)) {
    LOG_ERROR("Unable to write config file to disk");
  }
#endif
  // 3. now write back up to disk as well
  if (!LegacyConfigFile::FromPath(config_backup_path_).Write(pimpl_->cache_)) {
    LOG_ERROR("Unable to write backup config file");