-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace rcutils_get_file_size with rcpputils::fs::file_size #291
Replace rcutils_get_file_size with rcpputils::fs::file_size #291
Conversation
Signed-off-by: Zachary Michaels <zmichaels11@gmail.com>
Signed-off-by: Zachary Michaels <zmichaels11@gmail.com>
Signed-off-by: Zachary Michaels <zmichaels11@gmail.com>
Signed-off-by: Zachary Michaels <zmichaels11@gmail.com>
Signed-off-by: Zachary Michaels <zmichaels11@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with green CI
@@ -71,7 +71,8 @@ std::vector<uint8_t> get_input_buffer(const std::string & uri) | |||
throw std::runtime_error{errmsg.str()}; | |||
} | |||
|
|||
const auto decompressed_buffer_length = rcutils_get_file_size(uri.c_str()); | |||
const auto file_path = rcpputils::fs::path{uri}; | |||
const auto decompressed_buffer_length = file_path.exists() ? file_path.file_size() : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might want to use 0u
here and below. You've done this in the change before as well.
@ros2/aws-oncall - please run this CI job |
It looks like the macOS CI is currently broken due to infrastructure. |
Merging because this is passing on all systems. |
Changes
rcutils_file_size
withrcpputils::fs::file_size
std::remove
withrcpputils::fs::remove
Notes:
rcutils_file_size
returns 0ul when the file does not exist whilercpputils::fs::file_size
throws. Because of this, all changes in this PR must checkexists
before invokingfile_size
.ASSERT_TRUE
onrcpputils::fs::path::exists
instead of branching on it before invokingrcpputils::fs::path::file_size
. All asserts include a message to state that the expected path does not exist.