New Issue: '-M' flag should error (or warn?) if argument is not a directory

24770, "bradcray", "'-M' flag should error (or warn?) if argument is not a directory", "2024-04-04T17:22:31Z"

When using the -M flag, a user may misunderstand that it is meant to specify a directory rather than the location of a module itself. For example, rather than using -M path/to/lib/modules the user may use -M path/to/lib/modules/MyMod.chpl. At present, when this happens, the compiler does not complain, willing to accept the argument even though it is not a directory.

In this issue, I'm requesting that the compiler complain in such cases (where I'd probably error, but maybe there's a case to be made that a warning is better and sufficient) about the -M flag needing to be given a directory rather than a file. For example, in the example above:

$ error: The '-M' flag expects a directory as its argument but 'path/to/lib/modules/MyMod.chpl' is a file

I'm less certain whether the complaint should be made if the path exists but is a file; or whether it should also complain if the path doesn't exist (specifically, is it powerful/useful to let people specify directories that might only exist on some platforms but not others?). Here it might be useful to see what other compilers do with similar flags and follow their lead.