Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Public folder is not copied as a project file during "kpm pack"
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengTian committed Sep 16, 2014
1 parent a43244f commit d28ad9d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Microsoft.Framework.PackageManager/Packing/PackProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,28 @@ public void EmitSource(PackRoot root)
// A set of excluded files/directories used as a filter when doing copy
var excludeSet = new HashSet<string>(project.PackExcludeFiles, StringComparer.OrdinalIgnoreCase);

// If a public folder is specified with 'webroot' or '--wwwroot', we ignore it when copying project files
var wwwRootPath = string.Empty;
if (!string.IsNullOrEmpty(WwwRoot))
{
wwwRootPath = Path.Combine(project.ProjectDirectory, WwwRoot);
}

root.Operations.Copy(project.ProjectDirectory, TargetPath, (isRoot, filePath) =>
{
// If current file/folder is in the exclusion list, we don't copy it
if (excludeSet.Contains(filePath))
{
return false;
}
// If current folder is the public folder, we don't copy it to destination project
// All files/folders inside this folder also get ignored if we return false here
if (string.Equals(wwwRootPath, filePath))
{
return false;
}
// The full path of target generated by copy operation should also be excluded
var targetFullPath = filePath.Replace(project.ProjectDirectory, TargetPath);
excludeSet.Add(targetFullPath);
Expand Down

0 comments on commit d28ad9d

Please sign in to comment.