Update LibraryExporterExtensions.cs
tabs -> spaces
This commit is contained in:
parent
f769f9ea1c
commit
2084a099b8
1 changed files with 66 additions and 66 deletions
|
@ -10,77 +10,77 @@ using Microsoft.DotNet.ProjectModel.Graph;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Compiler.Common
|
namespace Microsoft.DotNet.Cli.Compiler.Common
|
||||||
{
|
{
|
||||||
public static class LibraryExporterExtensions
|
public static class LibraryExporterExtensions
|
||||||
{
|
{
|
||||||
public static IEnumerable<LibraryExport> GetAllProjectTypeDependencies(this LibraryExporter exporter)
|
public static IEnumerable<LibraryExport> GetAllProjectTypeDependencies(this LibraryExporter exporter)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
exporter.GetDependencies(LibraryType.Project)
|
exporter.GetDependencies(LibraryType.Project)
|
||||||
.Concat(exporter.GetDependencies(LibraryType.MSBuildProject));
|
.Concat(exporter.GetDependencies(LibraryType.MSBuildProject));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void CopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(destinationPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
}
|
||||||
|
|
||||||
public static void CopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath)
|
foreach (var asset in assets)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(destinationPath))
|
var file = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||||
{
|
File.Copy(asset.ResolvedPath, file, overwrite: true);
|
||||||
Directory.CreateDirectory(destinationPath);
|
RemoveFileAttribute(file, FileAttributes.ReadOnly);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var asset in assets)
|
private static void RemoveFileAttribute(String file, FileAttributes attribute)
|
||||||
{
|
{
|
||||||
var file = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
if (File.Exists(file))
|
||||||
File.Copy(asset.ResolvedPath, file, overwrite: true);
|
{
|
||||||
RemoveFileAttribute(file, FileAttributes.ReadOnly);
|
var fileAttributes = File.GetAttributes(file);
|
||||||
}
|
if ((fileAttributes & attribute) == attribute)
|
||||||
}
|
{
|
||||||
|
File.SetAttributes(file, fileAttributes & ~attribute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void RemoveFileAttribute(String file, FileAttributes attribute)
|
public static void StructuredCopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath, string tempLocation)
|
||||||
{
|
{
|
||||||
if (File.Exists(file))
|
if (!Directory.Exists(destinationPath))
|
||||||
{
|
{
|
||||||
var fileAttributes = File.GetAttributes(file);
|
Directory.CreateDirectory(destinationPath);
|
||||||
if ((fileAttributes & attribute) == attribute)
|
}
|
||||||
{
|
|
||||||
File.SetAttributes(file, fileAttributes & ~attribute);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void StructuredCopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath, string tempLocation)
|
foreach (var asset in assets)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(destinationPath))
|
var targetName = ResolveTargetName(destinationPath, asset);
|
||||||
{
|
var transformedFile = asset.GetTransformedFile(tempLocation);
|
||||||
Directory.CreateDirectory(destinationPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var asset in assets)
|
File.Copy(transformedFile, targetName, overwrite: true);
|
||||||
{
|
RemoveFileAttribute(targetName, FileAttributes.ReadOnly);
|
||||||
var targetName = ResolveTargetName(destinationPath, asset);
|
}
|
||||||
var transformedFile = asset.GetTransformedFile(tempLocation);
|
}
|
||||||
|
|
||||||
File.Copy(transformedFile, targetName, overwrite: true);
|
private static string ResolveTargetName(string destinationPath, LibraryAsset asset)
|
||||||
RemoveFileAttribute(targetName, FileAttributes.ReadOnly);
|
{
|
||||||
}
|
string targetName;
|
||||||
}
|
if (!string.IsNullOrEmpty(asset.RelativePath))
|
||||||
|
{
|
||||||
|
targetName = Path.Combine(destinationPath, asset.RelativePath);
|
||||||
|
var destinationAssetPath = Path.GetDirectoryName(targetName);
|
||||||
|
|
||||||
private static string ResolveTargetName(string destinationPath, LibraryAsset asset)
|
if (!Directory.Exists(destinationAssetPath))
|
||||||
{
|
{
|
||||||
string targetName;
|
Directory.CreateDirectory(destinationAssetPath);
|
||||||
if (!string.IsNullOrEmpty(asset.RelativePath))
|
}
|
||||||
{
|
}
|
||||||
targetName = Path.Combine(destinationPath, asset.RelativePath);
|
else
|
||||||
var destinationAssetPath = Path.GetDirectoryName(targetName);
|
{
|
||||||
|
targetName = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||||
if (!Directory.Exists(destinationAssetPath))
|
}
|
||||||
{
|
return targetName;
|
||||||
Directory.CreateDirectory(destinationAssetPath);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
targetName = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
|
||||||
}
|
|
||||||
return targetName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue