From 7e08bf6573a88e18880ca394ad9739c30aee1f71 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 12 Nov 2019 08:25:57 +0000 Subject: [PATCH] Filter the list of formats listed in 'convert' help. Closes #1590 * Only formats that support opening should be listed under the help for --input- format. --- renderdoccmd/renderdoccmd.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/renderdoccmd/renderdoccmd.cpp b/renderdoccmd/renderdoccmd.cpp index 2dfec0d00..daef13d86 100644 --- a/renderdoccmd/renderdoccmd.cpp +++ b/renderdoccmd/renderdoccmd.cpp @@ -619,12 +619,15 @@ struct ReplayCommand : public Command struct formats_reader { - formats_reader() + formats_reader(bool input) { ICaptureFile *tmp = RENDERDOC_OpenCaptureFile(); for(const CaptureFileFormat &f : tmp->GetCaptureFileFormats()) { + if(!f.openSupported && input) + continue; + exts.push_back(f.extension); names.push_back(f.name); } @@ -668,9 +671,9 @@ struct ConvertCommand : public Command parser.add("filename", 'f', "The file to convert from.", false); parser.add("output", 'o', "The file to convert to.", false); parser.add("input-format", 'i', "The format of the input file.", false, "", - formats_reader()); + formats_reader(true)); parser.add("convert-format", 'c', "The format of the output file.", false, "", - formats_reader()); + formats_reader(false)); parser.add("list-formats", '\0', "Print a list of target formats."); parser.stop_at_rest(true); }