当前位置: 首页>>代码示例>>C++>>正文


C++ path::has_parent_path方法代码示例

本文整理汇总了C++中path::has_parent_path方法的典型用法代码示例。如果您正苦于以下问题:C++ path::has_parent_path方法的具体用法?C++ path::has_parent_path怎么用?C++ path::has_parent_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在path的用法示例。


在下文中一共展示了path::has_parent_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: is_acceptable_output_file

/// \brief TODOCUMENT
bool options_block::is_acceptable_output_file(const path &arg_output_file ///< TODOCUMENT
                                              ) {
	if (exists(arg_output_file) && !is_regular_file(arg_output_file)) {
		return false;
	}
	if (arg_output_file.has_parent_path() && !is_directory(arg_output_file.parent_path())) {
		return false;
	}
	return true;
}
开发者ID:UCLOrengoGroup,项目名称:cath-tools,代码行数:11,代码来源:options_block.cpp

示例2: Save

void HTMLEditor::Save(const path & path)
{
    if (path.empty())
    {
        throw runtime_error("Path cannot be empty!");
    }

    if (path.has_parent_path())
    {
        create_directories(path.parent_path());
    }

    std::ofstream file(path.generic_string());

    if (!file.is_open())
    {
        throw runtime_error("Invalid path specified" + path.generic_string());
    }

    file << "<!DOCTYPE html>\n<html>\n<head>\n\t<title>" << EncodeHtmlStr(m_document.GetTitle()) << "</title>\n</head>\n"
        << "<body>\n" << CreateBody(path) << "</body>\n</html>";
    file.close();
}
开发者ID:AniSkyWorker,项目名称:OOD,代码行数:23,代码来源:HTMLEditor.cpp

示例3: create_directory_if_missing_recursive

static bool create_directory_if_missing_recursive(const path& dirpath)
{
	DBG_FS << "creating recursive directory: " << dirpath.string() << '\n';

	if (dirpath.empty())
		return false;
	error_code ec;
	bfs::file_status fs = bfs::status(dirpath);
	if (error_except_not_found(ec)) {
		ERR_FS << "Failed to retrieve file status for " << dirpath.string() << ": " << ec.message() << '\n';
		return false;
	} else if (bfs::is_directory(fs)) {
		return true;
	} else if (bfs::exists(fs)) {
		return false;
	}

	if (!dirpath.has_parent_path() || create_directory_if_missing_recursive(dirpath.parent_path())) {
		return create_directory_if_missing(dirpath);
	} else {
		ERR_FS << "Could not create parents to " << dirpath.string() << '\n';
		return false;
	}
}
开发者ID:m06x,项目名称:wesnoth,代码行数:24,代码来源:filesystem_boost.cpp


注:本文中的path::has_parent_path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。