-
Notifications
You must be signed in to change notification settings - Fork 497
Modernize: Use std::filesystem::path for p4includePath #5470
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
base: main
Are you sure you want to change the base?
Conversation
3b32f69 to
7a6bb25
Compare
Signed-off-by: Attaullah Ansari <[email protected]>
7a6bb25 to
23ed3f7
Compare
frontends/p4/toP4/toP4.cpp
Outdated
| if (includesEmitted.find(sourceFile) == includesEmitted.end()) { | ||
| if (sourceFile.startsWith(p4includePath)) { | ||
| const char *p = sourceFile.c_str() + strlen(p4includePath); | ||
| if (sourceFile.startsWith(p4includePath.generic_string().c_str())) { |
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 could probably convert sourcefile to a path too, should make this easier. If we are already modernizing we could also clean up the toP4 usage of files.
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.
Done! Added a commit using std::filesystem::relative() for the include path handling in toP4.
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.
Thanks. Let's convert sourceFile to std::filesystem::path also, then we should be done.
Signed-off-by: Attaullah Ansari <[email protected]>
Replaces C-string path handling with std::filesystem::path.
Key Changes
Path Handling:
p4includePathandp4_14includePathtostd::filesystem::path/)strdupusage in tests