mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Normalize file paths in find_file_in_path()
This renders script file names more nicely, for example when printed by the reporter. It also avoids redundant prefixing of "./" to local scripts. I'm not adding unit tests since normalize_path() already has them. A btest follows in the next commit.
This commit is contained in:
parent
e22bf8ebb6
commit
6108b18a3b
1 changed files with 3 additions and 3 deletions
|
@ -2010,7 +2010,7 @@ static string find_file_in_path(const string& filename, const string& path,
|
|||
if ( filepath.is_absolute() )
|
||||
{
|
||||
if ( can_read(filename) )
|
||||
return filename;
|
||||
return detail::normalize_path(filename);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
@ -2024,12 +2024,12 @@ static string find_file_in_path(const string& filename, const string& path,
|
|||
string with_ext = abs_path + ext;
|
||||
|
||||
if ( can_read(with_ext) )
|
||||
return with_ext;
|
||||
return detail::normalize_path(with_ext);
|
||||
}
|
||||
}
|
||||
|
||||
if ( can_read(abs_path) )
|
||||
return abs_path;
|
||||
return detail::normalize_path(abs_path);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue