diff --git a/doomsday/sdk/libcore/include/de/filesys/remote/remotefeedrelay.h b/doomsday/sdk/libcore/include/de/filesys/remote/remotefeedrelay.h index 6d4b24e1c6..b5308cb658 100644 --- a/doomsday/sdk/libcore/include/de/filesys/remote/remotefeedrelay.h +++ b/doomsday/sdk/libcore/include/de/filesys/remote/remotefeedrelay.h @@ -61,6 +61,8 @@ class DENG2_PUBLIC RemoteFeedRelay void removeRepository(String const &address); + Link *repository(String const &address) const; + StringList repositories() const; bool isConnected(String const &address) const; diff --git a/doomsday/sdk/libcore/src/filesys/package.cpp b/doomsday/sdk/libcore/src/filesys/package.cpp index 3773625fc5..ca4c819690 100644 --- a/doomsday/sdk/libcore/src/filesys/package.cpp +++ b/doomsday/sdk/libcore/src/filesys/package.cpp @@ -40,6 +40,7 @@ String const Package::VAR_ID ("ID"); String const Package::VAR_TITLE ("title"); String const Package::VAR_VERSION ("version"); +static String const PACKAGE_VERSION ("package.version"); static String const PACKAGE_ORDER ("package.__order__"); static String const PACKAGE_IMPORT_PATH("package.importPath"); static String const PACKAGE_REQUIRES ("package.requires"); @@ -482,6 +483,11 @@ String Package::versionedIdentifierForFile(File const &file) { return String("%1_%2").arg(id).arg(id_ver.second.fullNumber()); } + // The version may be specified in metadata. + if (auto const *pkgVer = file.objectNamespace().tryFind(PACKAGE_VERSION)) + { + return String("%1_%2").arg(id).arg(Version(pkgVer->value().asText()).fullNumber()); + } return id; } diff --git a/doomsday/sdk/libcore/src/filesys/remote/remotefeedrelay.cpp b/doomsday/sdk/libcore/src/filesys/remote/remotefeedrelay.cpp index 70c9248a9f..1c89007112 100644 --- a/doomsday/sdk/libcore/src/filesys/remote/remotefeedrelay.cpp +++ b/doomsday/sdk/libcore/src/filesys/remote/remotefeedrelay.cpp @@ -107,6 +107,16 @@ void RemoteFeedRelay::removeRepository(String const &address) } } +Link *RemoteFeedRelay::repository(String const &address) const +{ + auto found = d->repositories.constFind(address); + if (found != d->repositories.constEnd()) + { + return found.value(); + } + return nullptr; +} + StringList RemoteFeedRelay::repositories() const { StringList repos; @@ -119,10 +129,9 @@ StringList RemoteFeedRelay::repositories() const bool RemoteFeedRelay::isConnected(String const &address) const { - auto found = d->repositories.constFind(address); - if (found != d->repositories.constEnd()) + if (auto *repo = repository(address)) { - return found.value()->state() == Link::Ready; + return repo->state() == Link::Ready; } return false; }