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

Add parent directory creation to write_to_file function #2584

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Enes1313
Copy link

This commit adds the ability to create parent directories if they don't exist before writing a file in the write_to_file function. Additionally, an integration test has been changed to validate the behavior of the updated write_to_file function with parent directory creation.

This feature enables preserving the hierarchical structure of C/C++ projects where header files with the same name exist in different folders when generating bindings.

Additionally, this enhancement could have been implemented as an optional parameter if desired. If preferred, I can try refactor the changes to incorporate the functionality as an optional parameter.

@emilio

@pvdrz
Copy link
Contributor

pvdrz commented Jul 17, 2023

Is there any use case where calling create_dir_all before write_to_file is not enough?

@Enes1313
Copy link
Author

I thought it would be nicer to solve this by using the bindgen library. At the same time, in the bindgen CLI usage, there is no need for an additional operation like "mkdirs" command or "--create_dir_all" as the output is directly given. In this specific use case, simply outputting the generated bindings without performing a separate directory creation step is sufficient.

@pvdrz
Copy link
Contributor

pvdrz commented Jul 18, 2023

Even though I understand your point, I think this is not a strong enough reason to add this feature. That being said, I'll defer this to @emilio as he might think otherwise.

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.

None yet

2 participants