-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
policybuilder: Add
AnchorPathAbsolute
utility function.
This utility function can be used by users of the `PolicyBuilder` to create an absolute path anchored to a defined `base`. * If the path passed as `relative_path` is absolute; The path will be returned as is. * If the passed path is relative and `base` is not provided; The path will be resolved relative to the current working directory. * If the passed path is relative and an absolute `base` is provided; The path will be resolved relative to `base`. * If both, `relative_path` and `base` are relative, then first `base` will be resolved relative to the current working directory, and then `relative_path` will be resolved relative to `base`. In all cases where `relative_path` is relative; Any path elements such as dot-dot, dot, slash-slash, and trailing slash are cleaned up as string manipulation (no syscall is performed for path normalization). The result is then anchored to the base directory. In case of an error, an empty path will be returned. Calling `AddFile`, `AddFileAt`, `AddDirectory`, and `AddDirectoryAt` with empty strings does not result in an error on policy compilation. PiperOrigin-RevId: 719239498 Change-Id: Ie51cfb9171ee74934d2b663414c83b6245707aed
- Loading branch information
1 parent
7f62fb9
commit 7cb9a03
Showing
5 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters