[FEATURE REQUEST] oiiotool to be able to create output directories that don't yet exist #4598
Labels
difficulty/easy
Hours-to-days for veterans, days for newcomers to the project
feature request
oiiotool
oiiotool
Is your feature request related to a problem? Please describe.
When running oiiotool to do some reformatting work I noticed that if I specify an output path, where the directory does not exist oiiotool will perform the operation and consume the time but then fail on the output step after the work is done.
As a trivial example:
When combined with multiple operations the impact is a bit worse as I can potentially get partial completion as the stack is evaluated in order and terminates at the first error, in this case (which is slightly contrived, I admit) I'd take the source image, resize to 500px, output to a subdir, then output the jpg version of that alongside the full resolution, and finally make a jpg version from the full res.
I'll get outputfile.exr, it'll then consume the time to calculate the resize and then fail on the output for the missing subdirectory and terminate at that point.
Describe the solution you'd like
I'd ideally like to pass a
--make-paths
flag in the same way i can pass--no-clobber
so that the output stage would attempt to make the full path provided. If that failed, then behaviour as current where the remainder of the command for that frame doesn't get executed.In the same vein it'd be nice to have a way to fast-fail if it knew the output directory wasn't there and
--make-paths
wasn't supplied to save on computation time and IO but due to expressions that could depend on a characteristic of the image I'm not sure this is feasible (but would be nice). Wouldn't be that much of a saving overall, but I would prefer to have an all-or-nothing for the command as partial completion is harder to detect (and since it's a behaviour change from defaults it'd probably need to go behind a flag incase people are relying on current partial behaviour)Describe alternatives you've considered
Another option would be to pre-create directories or do a saning of the input command but I don't think this feels correct in the spirit of oiiotool. and due to the expression capability, is also I suspect fraught.
Additional context
Checked against oiiotool shipped with oiio 3.0.1 and 2.5.16, built using
vcpkg
and tripletx64-windows-static-release
buildinfo for completeness:
and
The text was updated successfully, but these errors were encountered: