base/utils/paths.zeek
Functions to parse and manipulate UNIX style paths and directories.
Summary
Constants
Functions
Constructs a path to a file given a directory and a file name. |
|
Returns a compressed path to a file given a directory and file name. |
|
Given an arbitrary string, extracts a single, absolute path (directory with filename). |
Detailed Interface
Constants
- absolute_path_pat
- Type:
- Default:
/^?((\/|[A-Za-z]:[\\\/]).*)$?/
Functions
- build_path
-
Constructs a path to a file given a directory and a file name.
- Parameters:
dir – the directory in which the file lives.
file_name – the name of the file.
- Returns:
the concatenation of the directory path and file name, or just the file name if it’s already an absolute path or dir is empty.
- build_path_compressed
-
Returns a compressed path to a file given a directory and file name. See
build_path
andcompress_path
.
- extract_path
-
Given an arbitrary string, extracts a single, absolute path (directory with filename).
Todo
Make this work on Window’s style directories.
- Parameters:
input – a string that may contain an absolute path.
- Returns:
the first absolute path found in input string, else an empty string.