示例#1
0
	virtual Status GetDirectoryEntries(const VfsPath& path, FileInfos* fileInfos, DirectoryNames* subdirectoryNames) const
	{
		ScopedLock s;
		VfsDirectory* directory;
		WARN_RETURN_STATUS_IF_ERR(vfs_Lookup(path, &m_rootDirectory, directory, 0));

		if(fileInfos)
		{
			const VfsDirectory::VfsFiles& files = directory->Files();
			fileInfos->clear();
			fileInfos->reserve(files.size());
			for(VfsDirectory::VfsFiles::const_iterator it = files.begin(); it != files.end(); ++it)
			{
				const VfsFile& file = it->second;
				fileInfos->push_back(FileInfo(file.Name(), file.Size(), file.MTime()));
			}
		}

		if(subdirectoryNames)
		{
			const VfsDirectory::VfsSubdirectories& subdirectories = directory->Subdirectories();
			subdirectoryNames->clear();
			subdirectoryNames->reserve(subdirectories.size());
			for(VfsDirectory::VfsSubdirectories::const_iterator it = subdirectories.begin(); it != subdirectories.end(); ++it)
				subdirectoryNames->push_back(it->first);
		}

		return INFO::OK;
	}
示例#2
0
std::wstring FileDescriptions(const VfsDirectory& directory, size_t indentLevel)
{
	VfsDirectory::VfsFiles files = directory.Files();

	std::wstring descriptions;
	descriptions.reserve(100*files.size());

	const std::wstring indentation(4*indentLevel, ' ');
	for(VfsDirectory::VfsFiles::const_iterator it = files.begin(); it != files.end(); ++it)
	{
		const VfsFile& file = it->second;
		descriptions += indentation;
		descriptions += FileDescription(file);
		descriptions += L"\n";
	}

	return descriptions;
}