Improve FileNameOption error handling
- Make FileNameOption check the presence of an input file for required
input options, and give an informative error message if that is not
the case. This hopefully reduces confusion about the
"File I/O error: topol.tpr" messages that are reported.
- Make FileNameOption check if the file name provided by the user for an
input file exists, and if it does, only check that it is valid for
fn2ftp() instead of overriding the user. If the file name is not
valid for the option, an informative error is given.
- Add a special mechanism for -multi and -multidir to avoid the check
above, as well as all other file name completion (that was done
earlier, but didn't really work as expected). The same mechanism
could also replace PCA_NOT_READ_NODE, if someone wants to make that
work again.
- Move all logic that changes user input to something else or checks
file system contents to FileNameOptionManager to make that more easily
customizable. FileNameOption without a manager now only checks that
the file name has a recognized and valid type for the option.
- Expose the necessary functionality through FileNameOptionInfo to do
the above.
- Split tests according to the above division of responsibilities, and
add tests for most of the error paths.
There is very little code that remains the same in this change, so the
rewrite and move are combined.
The first bullet causes some changes in behavior if programs have
declared file name options with ffREAD, but don't actually use the input
always, but those are easy to fix when found. This required changing
one existing test for pargs.cpp.
Change-Id: Iea2c60e5de35160cf1faf599afde99b9858e98c7
13 files changed: