Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

max-leuthaeuser
Copy link
Contributor

Paths provided via --include are now allowed to be relative to the input directory or absolute. They had to be absolute beforehand.

Paths provided via `--include` are now allowed to be relative to the input directory or absolute.
They had to be absolute beforehand.
Copy link
Contributor

@maltek maltek left a 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.

Comment on lines +30 to +32
case define if define.contains("=") =>
val split = define.split("=")
split.head -> split(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case define if define.contains("=") =>
val split = define.split("=")
split.head -> split(1)
case s"$define=$value" => define -> value

Copy link
Contributor Author

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.

Comment on lines +31 to +32
val split = define.split("=")
split.head -> split(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 =.

@max-leuthaeuser max-leuthaeuser deleted the max/includePathsFix branch January 28, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants