public virtual IEnumerable <string> GetPackageLookupPaths(string packageId, SemanticVersion version) { // Files created by the path resolver. This would take into account the non-side-by-side scenario // and we do not need to match this for id and version. var packageFileName = PathResolver.GetPackageFileName(packageId, version); var manifestFileName = Path.ChangeExtension(packageFileName, Constants.ManifestExtension); var filesMatchingFullName = Enumerable.Concat( GetPackageFiles(packageFileName), GetPackageFiles(manifestFileName)); if (version != null && version.Version.Revision < 1) { // If the build or revision number is not set, we need to look for combinations of the format // * Foo.1.2.nupkg // * Foo.1.2.3.nupkg // * Foo.1.2.0.nupkg // * Foo.1.2.0.0.nupkg // To achieve this, we would look for files named 1.2*.nupkg if both build and revision are 0 and // 1.2.3*.nupkg if only the revision is set to 0. string partialName = version.Version.Build < 1 ? String.Join(".", packageId, version.Version.Major, version.Version.Minor) : String.Join(".", packageId, version.Version.Major, version.Version.Minor, version.Version.Build); string partialManifestName = partialName + "*" + Constants.ManifestExtension; partialName += "*" + Constants.PackageExtension; // Partial names would result is gathering package with matching major and minor but different build and revision. // Attempt to match the version in the path to the version we're interested in. var partialNameMatches = GetPackageFiles(partialName).Where(path => FileNameMatchesPattern(packageId, version, path)); var partialManifestNameMatches = GetPackageFiles(partialManifestName).Where( path => FileNameMatchesPattern(packageId, version, path)); return(Enumerable.Concat(filesMatchingFullName, partialNameMatches).Concat(partialManifestNameMatches)); } return(filesMatchingFullName); }
protected virtual string GetPackageFilePath(string id, SemanticVersion version) { return(Path.Combine(PathResolver.GetPackageDirectory(id, version), PathResolver.GetPackageFileName(id, version))); }
protected virtual string GetPackageFilePath(IPackage package) { return(Path.Combine(PathResolver.GetPackageDirectory(package), PathResolver.GetPackageFileName(package))); }