internal virtual IEnumerable<CopyOperation> ResolveSourceLocations(SourceSet[] sourceSet, ILocation destinationLocation) { bool copyContainer = this.Container; foreach (var src in sourceSet) { var resolver = GetLocationResolver(src.ProviderInfo); foreach (var path in src.SourcePaths) { var location = resolver.GetLocation(path); var absolutePath = location.AbsolutePath; if (!location.IsFile) { // if this is not a file, then it should be a container. if (!location.IsItemContainer) { throw new CoAppException("Unable to resolve path '{0}' to a file or folder.".format(path)); } // if it's a container, get all the files in the container var files = location.GetFiles(Recurse); foreach (var f in files) { var relativePath = (copyContainer ? location.Name + @"\\" : "") + absolutePath.GetRelativePath(f.AbsolutePath); yield return new CopyOperation { Destination = destinationLocation.GetChildLocation(relativePath), Source = f }; } continue; } yield return new CopyOperation { Destination = destinationLocation.GetChildLocation(location.Name), Source = location }; } } }
internal virtual IEnumerable <CopyOperation> ResolveSourceLocations(SourceSet[] sourceSet, ILocation destinationLocation) { bool copyContainer = this.Container; foreach (var src in sourceSet) { var resolver = GetLocationResolver(src.ProviderInfo); foreach (var path in src.SourcePaths) { var location = resolver.GetLocation(path); var absolutePath = location.AbsolutePath; if (!location.IsFile) { // if this is not a file, then it should be a container. if (!location.IsItemContainer) { throw new ClrPlusException("Unable to resolve path '{0}' to a file or folder.".format(path)); } // if it's a container, get all the files in the container var files = location.GetFiles(Recurse); foreach (var f in files) { var relativePath = (copyContainer ? location.Name + @"\\" : "") + absolutePath.GetRelativePath(f.AbsolutePath); yield return(new CopyOperation { Destination = destinationLocation.IsFileContainer ? destinationLocation.GetChildLocation(relativePath) : destinationLocation, Source = f }); } continue; } yield return(new CopyOperation { Destination = destinationLocation.IsFileContainer ? destinationLocation.GetChildLocation(location.Name) : destinationLocation, Source = location }); } } }