tectonic
tectonic copied to clipboard
Add create output directory flag
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!
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.
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 😃.
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.
Great! I'll try to get something to you around Tuesday.