Skip to content

Commit

Permalink
Use fs instead of std::filesystem
Browse files Browse the repository at this point in the history
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
  • Loading branch information
hikinggrass committed Sep 29, 2023
1 parent f06ae2b commit 48a9fc1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
19 changes: 10 additions & 9 deletions include/ocpp/common/evse_security_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@

#include <evse_security.hpp>
#include <ocpp/common/evse_security.hpp>
#include <ocpp/common/support_older_cpp_versions.hpp>

namespace ocpp {

struct SecurityConfiguration {
std::filesystem::path csms_ca_bundle;
std::filesystem::path mf_ca_bundle;
std::filesystem::path mo_ca_bundle;
std::filesystem::path v2g_ca_bundle;
std::filesystem::path csms_leaf_cert_directory;
std::filesystem::path csms_leaf_key_directory;
std::filesystem::path secc_leaf_cert_directory;
std::filesystem::path secc_leaf_key_directory;
fs::path csms_ca_bundle;
fs::path mf_ca_bundle;
fs::path mo_ca_bundle;
fs::path v2g_ca_bundle;
fs::path csms_leaf_cert_directory;
fs::path csms_leaf_key_directory;
fs::path secc_leaf_cert_directory;
fs::path secc_leaf_key_directory;
std::optional<std::string> private_key_password;
};

Expand Down Expand Up @@ -81,4 +82,4 @@ evse_security::KeyPair from_ocpp(KeyPair other);

} // namespace ocpp

#endif
#endif
5 changes: 3 additions & 2 deletions include/ocpp/common/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <date/tz.h>

#include <ocpp/common/cistring.hpp>
#include <ocpp/common/support_older_cpp_versions.hpp>
#include <ocpp/v16/enums.hpp>
#include <ocpp/v201/enums.hpp>

Expand Down Expand Up @@ -506,8 +507,8 @@ struct OCSPRequestData {
};

struct KeyPair {
std::filesystem::path certificate_path;
std::filesystem::path key_path;
fs::path certificate_path;
fs::path key_path;
std::optional<std::string> password;
};

Expand Down
5 changes: 2 additions & 3 deletions include/ocpp/v16/charge_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ class ChargePoint {
/// security_configuration must be set
/// \param security_configuration specifies the file paths that are required to set up the internal evse_security
/// implementation
explicit ChargePoint(const std::string& config, const std::filesystem::path& share_path,
const std::filesystem::path& user_config_path, const std::filesystem::path& database_path,
const std::filesystem::path& sql_init_path, const std::filesystem::path& message_log_path,
explicit ChargePoint(const std::string& config, const fs::path& share_path, const fs::path& user_config_path,
const fs::path& database_path, const fs::path& sql_init_path, const fs::path& message_log_path,
const std::shared_ptr<EvseSecurity> evse_security,
const std::optional<SecurityConfiguration> security_configuration = std::nullopt);

Expand Down
7 changes: 3 additions & 4 deletions include/ocpp/v16/charge_point_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,9 @@ class ChargePointImpl : ocpp::ChargingStationBase {
/// also available) configuration keys in the "Internal" section of the config file. Please note that this is
/// intended for debugging purposes only as it logs all communication, including authentication messages.
/// \param evse_security Pointer to evse_security that manages security related operations
explicit ChargePointImpl(const std::string& config, const std::filesystem::path& share_path,
const std::filesystem::path& user_config_path, const std::filesystem::path& database_path,
const std::filesystem::path& sql_init_path, const std::filesystem::path& message_log_path,
const std::shared_ptr<EvseSecurity> evse_security,
explicit ChargePointImpl(const std::string& config, const fs::path& share_path, const fs::path& user_config_path,
const fs::path& database_path, const fs::path& sql_init_path,
const fs::path& message_log_path, const std::shared_ptr<EvseSecurity> evse_security,
const std::optional<SecurityConfiguration> security_configuration);

~ChargePointImpl() {
Expand Down
2 changes: 1 addition & 1 deletion lib/ocpp/common/schemas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void Schemas::load_root_schema() {
this->schema = json::parse(schema_file);

const auto custom_schema_path = schemas_path / "Custom.json";
if (std::filesystem::exists(custom_schema_path)) {
if (fs::exists(custom_schema_path)) {
json custom_object = {{"type", "object"}, {"$ref", "Custom.json"}};
this->schema["properties"]["Custom"] = custom_object;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/ocpp/v16/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
namespace ocpp {
namespace v16 {

ChargePoint::ChargePoint(const std::string& config, const std::filesystem::path& share_path,
const std::filesystem::path& user_config_path, const std::filesystem::path& database_path,
const std::filesystem::path& sql_init_path, const std::filesystem::path& message_log_path,
ChargePoint::ChargePoint(const std::string& config, const fs::path& share_path, const fs::path& user_config_path,
const fs::path& database_path, const fs::path& sql_init_path, const fs::path& message_log_path,
const std::shared_ptr<EvseSecurity> evse_security,
const std::optional<SecurityConfiguration> security_configuration) {
this->charge_point =
Expand Down
7 changes: 3 additions & 4 deletions lib/ocpp/v16/charge_point_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ const auto OCSP_REQUEST_TIMER_INTERVAL = std::chrono::hours(12);
const auto INITIAL_CERTIFICATE_REQUESTS_DELAY = std::chrono::seconds(60);
const auto WEBSOCKET_INIT_DELAY = std::chrono::seconds(2);

ChargePointImpl::ChargePointImpl(const std::string& config, const std::filesystem::path& share_path,
const std::filesystem::path& user_config_path,
const std::filesystem::path& database_path, const std::filesystem::path& sql_init_path,
const std::filesystem::path& message_log_path,
ChargePointImpl::ChargePointImpl(const std::string& config, const fs::path& share_path,
const fs::path& user_config_path, const fs::path& database_path,
const fs::path& sql_init_path, const fs::path& message_log_path,
const std::shared_ptr<EvseSecurity> evse_security,
const std::optional<SecurityConfiguration> security_configuration) :
ocpp::ChargingStationBase(evse_security, security_configuration),
Expand Down

0 comments on commit 48a9fc1

Please sign in to comment.