Introduce an option for disabling the automatic resolver in FileSourceFile
If someone needs to import a specific file, excluding the resolve process, with the actual structure is impossible.
Example:
The config file in the folder is called "config.toml" but the user asks for the file "config.ayeye". If I'm building the File with new or with_name, especially with new where you tell the FileFormat, the resolver in /src/file/source/file.rs line 37 if the file not exist search anyway other files with the same basename but one of the valid acceptable extension, reading the configuration from "config.toml" even if there was an error in the name.
That characteristic I'm sure is intended as a feature but in some peculiar case it can produce some very boring error, and only because the resolver cannot be disabled.
I'm proposing three solutions:
- Introduce a new
FileSourcenamedFileSourceExactFileand a new method inFilenamedwith_exact_name(&str, FileFormat)where the resolver is disabled. (I don't really like it as a solution) - Add a flag to the
FileSourceFilestruct nameduse_resolverand modify the signature ofnewand/orwith_name. (Breaking change is a big negative point) - Add a flag to the
FileSourceFilestruct nameduse_resolverand add a method inFile<FileSourceFile>similar torequired(bool)where the user can enable or disable the resolver inFileSourceFile(The best solution. No breaking change, no removing of feature, only adding an option flag that if not used will be set toTruefor retro compatibility)
I'm building the solution 3 for my project, if it is accepted as a good idea, when ready I will send a Pull Request.
Opinion? Question? Observation?