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


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

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


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

示例1: writeFileStream

std::shared_ptr<OStreamFile> writeFileStream( const fs::path &path, bool createParents )
{
	if( createParents && path.has_parent_path() ) {
		fs::create_directories( path.parent_path() );
	}
#if defined( CINDER_MSW )
	FILE *f = _wfopen( expandPath( path ).wstring().c_str(), L"wb" );
#else
	FILE *f = fopen( expandPath( path ).string().c_str(), "wb" );
#endif
	if( f ) {
		OStreamFileRef s = OStreamFile::create( f, true );
		s->setFileName( path );
		return s;
	}
	else
		return std::shared_ptr<OStreamFile>();
}
开发者ID:AbdelghaniDr,项目名称:Cinder,代码行数:18,代码来源:Stream.cpp

示例2: add_file

	void file_storage::add_file(fs::path const& file, size_type size, int flags
		, std::time_t mtime, fs::path const& symlink_path)
	{
		TORRENT_ASSERT(size >= 0);
#if BOOST_VERSION < 103600
		if (!file.has_branch_path())
#else
		if (!file.has_parent_path())
#endif
		{
			// you have already added at least one file with a
			// path to the file (branch_path), which means that
			// all the other files need to be in the same top
			// directory as the first file.
			TORRENT_ASSERT(m_files.empty());
			m_name = file.string();
		}
		else
		{
			if (m_files.empty())
				m_name = *file.begin();
		}
		TORRENT_ASSERT(m_name == *file.begin());
		m_files.push_back(file_entry());
		file_entry& e = m_files.back();
		e.size = size;
		e.path = file;
		e.offset = m_total_size;
		e.pad_file = bool(flags & pad_file);
		e.hidden_attribute = bool(flags & attribute_hidden);
		e.executable_attribute = bool(flags & attribute_executable);
		e.symlink_attribute = bool(flags & attribute_symlink);
		if (e.symlink_attribute) e.symlink_path = symlink_path.string();
		e.mtime = mtime;
		m_total_size += size;
	}
开发者ID:BlackYoup,项目名称:medusa,代码行数:36,代码来源:file_storage.cpp


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