create_directories returns true if the path is empty#97
create_directories returns true if the path is empty#97fujitatomoya wants to merge 2 commits intoros2:masterfrom
Conversation
e8140e0 to
6faac68
Compare
Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
6faac68 to
8da0c7c
Compare
|
I've added minor fix based on #95. confirmed rosbag2 test does not detects any failures. |
|
thank you @fujitatomoya! |
clalancette
left a comment
There was a problem hiding this comment.
The problem I have with this change is that this makes us act different than std::filesystem (which we eventually want to switch to). As far as I can tell, if you call:
std::filesystem::create_directories("");
It throws an exception:
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
what(): filesystem error: cannot create directories: Invalid argument []
Also, from a pure semantic point-of-view, the documentation says that it returns true if the directory is created, and false otherwise. Since it could not create the directory on an empty string, returning true seems wrong here.
My suggestion is that we actually fix the test in rosbag2 that is trying to call this API with an empty string. Once that is done, we can reapply #95 as it was, and then things shouldn't break on the farm.
|
That makes sense. I can do the rosbag2 changes (@fujitatomoya let me know if you've started working on it). |
I opened ros2/rosbag2#526 |
|
@christophebedard @clalancette i will close this PR, you can revert #96 after ros2/rosbag2#526. |
fix #94, and address #96