  Params::Params(bool persistent_param) : Params(persistent_param ? persistent_params_path : default_params_path) {}
  
  std::once_flag default_params_path_ensured;
  Params::Params(const std::string &path) : params_path(path) {
    if (path == default_params_path) {
      std::call_once(default_params_path_ensured, ensure_params_path, path);
    } else {
      ensure_params_path(path);
    }
  }
 
</s> remove Params::Params(bool persistent_param) : Params(persistent_param ? persistent_params_path : default_params_path) {}
 </s> add Params::Params(bool persistent_param) : Params(persistent_param ? Path::persistent_params() : Path::params()) {} </s> remove std::string getenv_default(const char* env_var, const char * suffix, const char* default_val) {
  const char* env_val = getenv(env_var);
  if (env_val != NULL) {
    return std::string(env_val) + std::string(suffix);
  } else {
    return std::string(default_val);
  }
 </s> add std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val; </s> remove const std::string default_params_path = Hardware::PC() ? util::getenv_default("HOME", "/.comma/params", "/data/params")
                                                       : "/data/params";
const std::string persistent_params_path = Hardware::PC() ? default_params_path : "/persist/comma/params";

 </s> add  </s> remove   auto file = QFile(private_key_path.c_str());
 </s> add   auto file = QFile(Path::rsa_file().c_str()); </s> remove const std::string private_key_path =
    Hardware::PC() ? util::getenv_default("HOME", "/.comma/persist/comma/id_rsa", "/persist/comma/id_rsa")
                   : "/persist/comma/id_rsa";

 </s> add 
  if (path == Path::params()) {
  Params::Params(bool persistent_param) : Params(persistent_param ? persistent_params_path : default_params_path) {}
  
  std::once_flag default_params_path_ensured;
  Params::Params(const std::string &path) : params_path(path) {
  if (path == Path::params()) {
      std::call_once(default_params_path_ensured, ensure_params_path, path);
    } else {
      ensure_params_path(path);
    }
  }
keep keep keep keep replace keep keep keep keep keep
 hw.h: move Hardware-related paths to namespace Path (#21826)

* refactor getenv and path

* apply review 
selfdrive/common/params.cc