Conversation
|
+1 the logic looks fine. My first interpretation of |
|
please don't merge yet |
|
thanks for waiting. The logic looks good to me too. While I was investigating something I added a couple of tests in #18 which check that the expected path is being returned. On the name, "prefix path" might be clearer than "base path". That's the term used in the environment variable As for the Python API, maybe add a |
27fc614 to
d04155f
Compare
|
Renamed to |
|
Regarding the Python API I am not sure that a different return value structure based on the arguments is a good thing. I would expect that this would break user expectation quite often. But we can make the decision independently of this PR - maybe talk about it in an upcoming meeting. |
|
I agree that changing the return type based on the argument would lead to unexpected breakages when refactoring. Thinking about this I think that there's 3 potential queries that one might want. The content, the full path, or the prefix_path. This approach covers 2 of the 3, but actually requires reading in the full content, which might be large, just to return the prefix_path. I think that 3 separate calls might make sense for both languages. Unless we're worried about race conditions there's no need to bundle the queries. |
|
Regarding the full path, I get the impression that it's not something the user should be getting access to since it's kind of an implementation detail of the index. Returning the prefix path of a found resource is useful for knowing which prefix the resource came from in the case that there are many prefixes, but I don't think the user is expected to manipulate the resources themselves. I didn't see it explicitly written in the documentation but I think I have gotten this impression from conversations in the past About having separate vs bundled functions, the python API has I suppose that depending on how strongly we feel about keeping the functions separate, it may end up affecting this PR. but I agree that once that decision is made about how to approach exposing the functionality (maybe it doesn't have to be the same across the languages), the python implementation details can be discussed independently |
|
@tfoote I don't think that splitting these queries into three separate functions is a good idea. The information returned is based on the environment and filesystem. There is no way to ensure atomic operation across those functions therefore the individual results of them might be inconsistent. Therefore I don't think it is a good API design to separate them. |
c03b555 to
d2d95f2
Compare
ament_index_cpp/src/has_resource.cpp
Outdated
|
|
||
| #include "ament_index_cpp/has_resource.hpp" | ||
|
|
||
| #include <cassert> |
There was a problem hiding this comment.
can this be removed for both files?
There was a problem hiding this comment.
Indeed, I removed it from two files as well as sstream from this.
|
I reverted the change to the copyright year since the code was written in 2015 (coming from the other file). So it shouldn't be 2016. |
93b81de to
d7b2a2d
Compare
d7b2a2d to
80b1090
Compare
|
Should I wait for explicit approvals for the referenced PRs or are they implicitly ok to be merged too? |
|
can this branch be deleted? |
|
Absolutely, done. |
The C++ part can be reviewed and merged.
I would be curious how others would sugggest to update the Python API to provide the same feature.