NuGet.PackageBuilder.AddFiles C# (CSharp) Method

AddFiles() private method

private AddFiles ( string basePath, string source, string destination, string exclude = null ) : void
basePath string
source string
destination string
exclude string
return void
        private void AddFiles(string basePath, string source, string destination, string exclude = null)
        {
            string fileName = Path.GetFileName(source);

            // treat empty files specially
            if (Constants.PackageEmptyFileName.Equals(fileName, StringComparison.OrdinalIgnoreCase))
            {
                string destinationPath = Path.GetDirectoryName(destination);
                if (String.IsNullOrEmpty(destinationPath))
                {
                    destinationPath = Path.GetDirectoryName(source);
                }
                Files.Add(new EmptyFolderFile(destinationPath));
            }
            else
            {
                List<PackageFileBase> searchFiles = PathResolver.ResolveSearchPattern(basePath, source, destination).ToList();
                ExcludeFiles(searchFiles, basePath, exclude);

                if (!PathResolver.IsWildcardSearch(source) && !PathResolver.IsDirectoryPath(source) && !searchFiles.Any())
                {
                    throw new FileNotFoundException(String.Format(CultureInfo.CurrentCulture,
                                                                  NuGetResources.PackageAuthoring_FileNotFound,
                                                                  source));
                }

                Files.AddRange(searchFiles);
            }
        }