mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
GH-1041: Move compress_path to a bif that uses normalize_path
This commit is contained in:
parent
3d3d5e7eb4
commit
560ee0c05e
4 changed files with 22 additions and 39 deletions
11
src/zeek.bif
11
src/zeek.bif
|
@ -5157,3 +5157,14 @@ function to_json%(val: any, only_loggable: bool &default=F, field_escape_pattern
|
|||
%{
|
||||
return val->ToJSON(only_loggable, field_escape_pattern);
|
||||
%}
|
||||
|
||||
## Compresses a given path by removing '..'s and the parent directory it
|
||||
## references and also removing dual '/'s and extraneous '/./'s.
|
||||
##
|
||||
## dir: a path string, either relative or absolute.
|
||||
##
|
||||
## Returns: a compressed version of the input path.
|
||||
function compress_path%(dir: string%): string
|
||||
%{
|
||||
return zeek::make_intrusive<zeek::StringVal>(normalize_path(dir->ToStdString()));
|
||||
%}
|
Loading…
Add table
Add a link
Reference in a new issue