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 create output directory flag #1090

Open
PriceHiller opened this issue Sep 13, 2023 · 4 comments
Open

Add create output directory flag #1090

PriceHiller opened this issue Sep 13, 2023 · 4 comments

Comments

@PriceHiller
Copy link

PriceHiller commented Sep 13, 2023

Hey there!

I did see a previous issue, #890 and I figured I'd "recreate" it in a way.

Would y'all accept a PR adding a flag --output-create-dir or some equivalent that automatically creates the output
directory if it doesn't exist?

If so, I'd be more than happy to implement this feature with test coverage and send it your way!

@PriceHiller PriceHiller changed the title Create the output directory if it doesn't exist Add create output directory flag Sep 13, 2023
PriceHiller added a commit to PriceHiller/tectonic that referenced this issue Sep 13, 2023
@pkgw
Copy link
Collaborator

pkgw commented Sep 24, 2023

Well, based on the discussion in #891, it seemed like there were a number of people interested in having such a feature. I have to confess that I personally don't quite understand why people feel that mkdir -p (or equivalent) isn't sufficient, but the consensus from the discussion is pretty clear.

One thing that's always on my mind is that I really want to prevent the core compile functionality from acquiring an enormous list of command line options, and it would be nice to provide this feature without adding one. But seeing as it's an optional, user-controlled behavior request, I'm pretty sure there's no other way. It could potentially be a -Z "unstable option", I guess.

Terminologically, if the idea is to only create the directory if needed, and not error out if it already exists (which certainly makes sense to me), I would call it something like "ensure output directory" rather than "create output directory". To me, the latter implies that it might be an error if the directory already exists.

@PriceHiller
Copy link
Author

I can certainly refactor this to be "ensure output directory", that's more correct, you're absolutely right. If you're ok with this feature, I can introduce a new commit that changes the flag to --ensure-output-dir and write some tests for it tomorrow or Tuesday.

As for why I don't go for mkdir -p, it has to do with Texlab auto building on save. It's a bit hacky to create the directory on save hopefully before Texlab tries to run Tectonic. Perhaps I'm wrong for trying to roll Texlab autobuild with Tectonic and I'm missing a better way of handling this.

I absolutely understand your desire to reduce the amount of flags that make it into the core functionality, scope creep can certainly be problematic. I'm of the opinion though that creating the output directory (or having a flag to do so) is more in line with many other build tools already out there. A bit of familiarity on that front.

Do let me know if this feature is something you'll accept a PR for, I'm more than willing get one to you 😃.

@pkgw
Copy link
Collaborator

pkgw commented Sep 25, 2023

Sorry, I didn't explicitly say so before — a PR would definitely be welcome! Especially with test coverage, and if you can mention it in the documentation, that would be great.

@PriceHiller
Copy link
Author

Great! I'll try to get something to you around Tuesday.

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

No branches or pull requests

2 participants