-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add utility function to get the size of a file #28
Conversation
Signed-off-by: Anas Abou Allaban <allabana@amazon.com>
Signed-off-by: Anas Abou Allaban <allabana@amazon.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.
A few style nits
Signed-off-by: Anas Abou Allaban <allabana@amazon.com>
15cb401
to
150d60b
Compare
Signed-off-by: Anas Abou Allaban <allabana@amazon.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.
Let's clean-up this PR and remove all the C code whenever possible:
char * -> std::string, etc.
@thomas-moulard FYI, @zmichaels11 Take a look at some of the |
We should probably clean both IMHO. |
Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
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.
Unblocking this I'm OOO from next week.
If you have any comments/suggestions tho lmk! Most likely I will introduce the Windows and Linux fixes separately. |
After discussion with @emersonknapp , this may not be the best approach, rather, create a wrapper around the C++17 FileSystem API with CMake linkers to C bindings. |
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.
@piraka9011 The TCHAR code seems to instantiate a variable w/o using it - could you PTAL?
src/find_library.cpp | ||
src/filesystem_helper.cpp) |
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.
alphasort
// Increase length by two to add the double null termination | ||
const auto char_length = strlen(text.c_str()); | ||
const auto new_text = std::make_unique<TCHAR[]>(char_length + 2); | ||
// memcpy(temp_dir, text.c_str(), length); |
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.
remove
void remove_directory_recursively(const std::string & directory_path) | ||
{ | ||
#ifdef _WIN32 | ||
const auto null_terminated_directory = create_double_null_terminated_tchar(directory_path); |
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.
This is never used?
Resolved by ros2/rcutils#197 |
Changes
std::fs::file_size
shim.file_size()
.Signed-off-by: Anas Abou Allaban allabana@amazon.com