internal IEnumerable<string> GetRepositoryPaths()
{
// The store file is in this format
// <repositories>
// <repository path="..\packages.config" />
// </repositories>
XDocument document = GetStoreDocument();
// The document doesn't exist so do nothing
if (document == null)
{
return Enumerable.Empty<string>();
}
// Only save if we changed the document
bool requiresSave = false;
// Paths have to be relative to the this repository
var paths = new HashSet<string>();
foreach (var e in GetRepositoryElements(document).ToList())
{
string path = NormalizePath(e.GetOptionalAttributeValue("path"));
if (String.IsNullOrEmpty(path) ||
!FileSystem.FileExists(path) ||
!paths.Add(path))
{
// Skip bad entries
e.Remove();
requiresSave = true;
}
}
if (requiresSave)
{
SaveDocument(document);
}
return paths;
}