Analysis::Path::Ptr GetPluginsChain() const override { const Analysis::Path::Ptr parentPlugins = Parent->GetPluginsChain(); if (Subdata->GetOffset()) { return parentPlugins->Append(Subplugin); } return parentPlugins; }
Analysis::Path::Ptr GetPath() const override { const Analysis::Path::Ptr parentPath = Parent->GetPath(); if (std::size_t offset = Subdata->GetOffset()) { const String subPath = RawPath.Build(offset); return parentPath->Append(subPath); } return parentPath; }
DataLocation::Ptr OpenLocation(Parameters::Accessor::Ptr coreParams, Binary::Container::Ptr data, const String& subpath) { const ArchivePluginsEnumerator::Ptr usedPlugins = ArchivePluginsEnumerator::Create(); DataLocation::Ptr resolvedLocation = boost::make_shared<UnresolvedLocation>(data); const Analysis::Path::Ptr sourcePath = Analysis::ParsePath(subpath, Text::MODULE_SUBPATH_DELIMITER[0]); for (Analysis::Path::Ptr unresolved = sourcePath; !unresolved->Empty(); unresolved = sourcePath->Extract(resolvedLocation->GetPath()->AsString())) { const String toResolve = unresolved->AsString(); Dbg("Resolving '%1%'", toResolve); if (!(resolvedLocation = TryToOpenLocation(*usedPlugins, *coreParams, resolvedLocation, *unresolved))) { throw MakeFormattedError(THIS_LINE, translate("Failed to resolve subpath '%1%'."), subpath); } } Dbg("Resolved '%1%'", subpath); return resolvedLocation; }
Formats::Archived::File::Ptr FindFile(const Formats::Archived::Container& container, const Analysis::Path& path) const { Analysis::Path::Ptr resolved = Analysis::ParsePath(String(), Text::MODULE_SUBPATH_DELIMITER[0]); for (const Analysis::Path::Iterator::Ptr components = path.GetIterator(); components->IsValid(); components->Next()) { resolved = resolved->Append(components->Get()); const String filename = resolved->AsString(); Dbg("Trying '%1%'", filename); if (Formats::Archived::File::Ptr file = container.FindFile(filename)) { Dbg("Found"); return file; } if (!SupportDirectories) { break; } } return Formats::Archived::File::Ptr(); }