folly::fs::canonical_parent

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.

Synopsis

Declared in <folly/io/FsUtil.h>

path
canonical_parent(
    path const& p,
    path const& basePath = current_path());

Return Value

The path with its parent canonicalized.

Parameters

NameDescription
pThe path whose parent is canonicalized.
basePathThe base used to resolve relative paths.