Skip to content

Commit 4ff4a02

Browse files
lgritzscott-wilson
authored andcommitted
oiiotool: better handling of wildcards that match no files (AcademySoftwareFoundation#4627)
When you use frame or view wildcards, for example: oiiotool foo.%04d.tif -o bar.%04d.exr we noticed that if NO files matched, no iteration would occur. You would get this output: ``` $ oiiotool foo.%04d.tif -o bar.%04d.exr oiiotool WARNING : oiiotool produced no output. Did you forget -o? ``` But maybe this is not helpful and it should be some kind of error to ask for a match and not get one? Or at least give a more clear explanation of what happened. This PR detects the case where there is no match of the wildcard at all, warns about that, and then tries interpreting the command line literally (no wildcard expansion). So now the output is ``` $ oiiotool foo.%04d.tif -o bar.%04d.exr oiiotool WARNING : No frame number or views matched the wildcards oiiotool ERROR: read : File does not exist: "foo.%04d.tif" Full command line was: > oiiotool foo.%04d.tif -o bar.%04d.exr ``` Closes AcademySoftwareFoundation#4623 Signed-off-by: Larry Gritz <[email protected]> Signed-off-by: Scott Wilson <[email protected]>
1 parent ffc3a12 commit 4ff4a02

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/oiiotool/oiiotool.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7329,6 +7329,12 @@ handle_sequence(Oiiotool& ot, int argc, const char** argv)
73297329
nfilenames = frame_numbers[0].size();
73307330
}
73317331

7332+
if (!nfilenames) {
7333+
// No filenames matched the first wildcard pattern
7334+
ot.warning("", "No frame number or views matched the wildcards");
7335+
return false;
7336+
}
7337+
73327338
// Make sure frame_numbers[0] has the canonical frame number list
73337339
if (sequence_args.size() && frame_numbers[0].empty())
73347340
frame_numbers[0] = frame_numbers[sequence_args[0]];

testsuite/oiiotool-control/ref/out.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ Sequence -5--2: -5
281281
Sequence -5--2: -4
282282
Sequence -5--2: -3
283283
Sequence -5--2: -2
284-
oiiotool WARNING : oiiotool produced no output. Did you forget -o?
284+
oiiotool WARNING : No frame number or views matched the wildcards
285+
oiiotool ERROR: read : File does not exist: "notfound.#.jpg"
286+
Full command line was:
287+
> oiiotool notfound.#.jpg -o alsonotfound.#.jpg
285288
oiiotool ERROR : Not all sequence specifications matched: copyA.#.jpg (10 frames) vs. copyC.1-5#.jpg (5 frames)
286289
Full command line was:
287290
>

0 commit comments

Comments
 (0)