Пример #1
0
// -----------------------------------------------------------------------------
// Returns the entry at the given path in the archive, or null if it doesn't
// exist
// -----------------------------------------------------------------------------
ArchiveEntry* Archive::entryAtPath(string_view path)
{
	// Get path as wxFileName for processing
	StrUtil::Path fn(StrUtil::startsWith(path, '/') ? path.substr(1) : path);

	// Get directory from path
	ArchiveTreeNode* dir;
	if (fn.path(false).empty())
		dir = &dir_root_;
	else
		dir = this->dir(fn.path(true));

	// If dir doesn't exist, return nullptr
	if (!dir)
		return nullptr;

	// Return entry
	return dir->entry(fn.fileName());
}