proxygen
|
Functions | |
bool | starts_with (const path &pth, const path &prefix) |
path | remove_prefix (const path &pth, const path &prefix) |
path | canonical_parent (const path &pth, const path &base) |
path | executable_path () |
path folly::fs::canonical_parent | ( | const path & | p, |
const path & | basePath = current_path() |
||
) |
Canonicalize the parent path, leaving the filename (last component) unchanged. You may use this before creating a file instead of boost::filesystem::canonical, which requires that the entire path exists.
Definition at line 68 of file FsUtil.cpp.
Referenced by TEST().
path folly::fs::executable_path | ( | ) |
Get the path to the current executable.
Note that this is not reliable and not recommended in general; it may not be implemented on your platform (in which case it will throw), the executable might have been moved or replaced while running, and applications comprising of multiple executables should use some form of configuration system to find the other executables rather than relying on relative paths from one to another.
So this should only be used for tests, logging, or other innocuous purposes.
Definition at line 72 of file FsUtil.cpp.
Referenced by TEST().
path folly::fs::remove_prefix | ( | const path & | p, |
const path & | prefix | ||
) |
If "path" starts with "prefix", return "path" with "prefix" removed. Otherwise, throw filesystem_error.
Definition at line 50 of file FsUtil.cpp.
Referenced by TEST().
bool folly::fs::starts_with | ( | const path & | p, |
const path & | prefix | ||
) |
Check whether "path" starts with "prefix". That is, if prefix has n path elements, then the first n elements of path must be the same as prefix.
There is a special case if prefix ends with a slash: /foo/bar/ is not a prefix of /foo/bar, but both /foo/bar and /foo/bar/ are prefixes of /foo/bar/baz.
Definition at line 45 of file FsUtil.cpp.
Referenced by TEST().