本文整理汇总了C++中utils::fs::path::branch_path方法的典型用法代码示例。如果您正苦于以下问题:C++ path::branch_path方法的具体用法?C++ path::branch_path怎么用?C++ path::branch_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils::fs::path
的用法示例。
在下文中一共展示了path::branch_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: F
/// Computes the path to a new database for the given test suite.
///
/// \param root Path to the root of the test suite being run; needed to properly
/// autogenerate the identifiers.
/// \param when Timestamp for the test suite being run; needed to properly
/// autogenerate the identifiers.
///
/// \return Identifier of the created results file, if applicable, and the path
/// to such file.
fs::path
layout::new_db_for_migration(const fs::path& root,
const datetime::timestamp& when)
{
const std::string generated_id = new_id(test_suite_for_path(root), when);
const fs::path path = query_store_dir() / (
F("results.%s.db") % generated_id);
fs::mkdir_p(path.branch_path(), 0755);
return path;
}
示例2: kyuafile
/// Parses a test suite configuration file.
///
/// \param file The file to parse.
/// \param user_build_root If not none, specifies a path to a directory
/// containing the test programs themselves. The layout of the build root
/// must match the layout of the source root (which is just the directory
/// from which the Kyuafile is being read).
///
/// \return High-level representation of the configuration file.
///
/// \throw load_error If there is any problem loading the file. This includes
/// file access errors and syntax errors.
engine::kyuafile
engine::kyuafile::load(const fs::path& file,
const optional< fs::path > user_build_root)
{
const fs::path source_root_ = file.branch_path();
const fs::path build_root_ = user_build_root ?
user_build_root.get() : source_root_;
return kyuafile(source_root_, build_root_,
parser(source_root_, build_root_,
fs::path(file.leaf_name())).parse());
}
示例3: catch
/// Creates a directory and any missing parents.
///
/// This is separate from the fs::mkdir function to clearly differentiate the
/// libc wrapper from the more complex algorithm implemented here.
///
/// \param dir The path to the directory to create.
/// \param mode The permissions for the new directories.
///
/// \throw system_error If any call to mkdir(2) fails.
void
fs::mkdir_p(const fs::path& dir, const int mode)
{
try {
fs::mkdir(dir, mode);
} catch (const fs::system_error& e) {
if (e.original_errno() == ENOENT) {
fs::mkdir_p(dir.branch_path(), mode);
fs::mkdir(dir, mode);
} else if (e.original_errno() != EEXIST)
throw e;
}
}