dtoolutil/express: Resolving empty filename should yield no result

See #1140 - I may revert this if someone can demonstrate a compelling use case (for current directory, you can use "." instead), but it seems to have the potential to cause unintuitive behavior.
This commit is contained in:
rdb 2021-04-09 18:21:36 +02:00
parent 47f35a287c
commit e9e1bb1bc6
2 changed files with 8 additions and 0 deletions

View File

@ -242,6 +242,10 @@ get_directory(size_t n) const {
*/
Filename DSearchPath::
find_file(const Filename &filename) const {
if (filename.empty()) {
return string();
}
if (filename.is_local()) {
if (_directories.empty()) {
// Let's say an empty search path is the same as a search path

View File

@ -649,6 +649,10 @@ find_file(const Filename &filename, const DSearchPath &searchpath,
return get_file(filename, status_only);
}
if (filename.empty()) {
return nullptr;
}
int num_directories = searchpath.get_num_directories();
for (int i = 0; i < num_directories; ++i) {
Filename match(searchpath.get_directory(i), filename);