-
Notifications
You must be signed in to change notification settings - Fork 297
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
[c2cpg] Fix handling of include paths #5264
Conversation
Paths provided via `--include` are now allowed to be relative to the input directory or absolute. They had to be absolute beforehand.
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.
From general CLI conventions, I'd expect a relative path to be relative to the current working directory. E.g. that's how shell completion works.
Not a hard no on interpreting this relative to the input path, but it feels a bit weird to me.
case define if define.contains("=") => | ||
val split = define.split("=") | ||
split.head -> split(1) |
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.
case define if define.contains("=") => | |
val split = define.split("=") | |
split.head -> split(1) | |
case s"$define=$value" => define -> value |
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.
From general CLI conventions, I'd expect a relative path to be relative to the current working directory. E.g. that's how shell completion works.
Did not think about that. Yeah, lets keep it that way.
val split = define.split("=") | ||
split.head -> split(1) |
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.
val split = define.split("=") | |
split.head -> split(1) | |
val Array(key, value) = define.split("=") | |
key -> value |
IMO that's more readable, but feel free to disregard.
Note that it behaves slightly differently if there's two =
in the string. My suggestion will throw a MatchError while yours will silently drop everything from the second =
.
Paths provided via
--include
are now allowed to be relative to the input directory or absolute. They had to be absolute beforehand.