ament / ament_index

Apache License 2.0
13 stars 27 forks source link

Feature Request: Support for std::filesystem::path in ament_index_cpp #92

Open Ryanf55 opened 9 months ago

Ryanf55 commented 9 months ago

Feature Request

Could this library support the use std::filesystem::path? You can also use std::optional to represent optional parameters without a raw pointer. Both are C++17 only.

Example

AMENT_INDEX_CPP_PUBLIC
bool
get_resource(
  const std::string & resource_type,
  const std::string & resource_name,
  std::string & content,
  std::optional<std::filesystem::path> prefix_path = std::nullopt);

AMENT_INDEX_CPP_PUBLIC
std::filesystem::path
get_package_prefix(const std::string & package_name);

For functions that return std::string currently such as get_package_prefix, an alternative signature may be needed to preserve ABI such as:

AMENT_INDEX_CPP_PUBLIC
void
get_package_prefix(const std::string & package_name, std::filesystem::path & path);

Then, the library could go through a deprecation process of returning std::string paths and slowly convert the ecosystem to using std::filesystem for path-like types.