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
|
||||
{
|
||||
public static class LibraryExporterExtensions
|
||||
{
|
||||
public static IEnumerable<LibraryExport> GetAllProjectTypeDependencies(this LibraryExporter exporter)
|
||||
{
|
||||
return
|
||||
exporter.GetDependencies(LibraryType.Project)
|
||||
.Concat(exporter.GetDependencies(LibraryType.MSBuildProject));
|
||||
}
|
||||
public static class LibraryExporterExtensions
|
||||
{
|
||||
public static IEnumerable<LibraryExport> GetAllProjectTypeDependencies(this LibraryExporter exporter)
|
||||
{
|
||||
return
|
||||
exporter.GetDependencies(LibraryType.Project)
|
||||
.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)
|
||||
{
|
||||
if (!Directory.Exists(destinationPath))
|
||||
{
|
||||
Directory.CreateDirectory(destinationPath);
|
||||
}
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
var file = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||
File.Copy(asset.ResolvedPath, file, overwrite: true);
|
||||
RemoveFileAttribute(file, FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
var file = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||
File.Copy(asset.ResolvedPath, file, overwrite: true);
|
||||
RemoveFileAttribute(file, FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
private static void RemoveFileAttribute(String file, FileAttributes attribute)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
{
|
||||
var fileAttributes = File.GetAttributes(file);
|
||||
if ((fileAttributes & attribute) == attribute)
|
||||
{
|
||||
File.SetAttributes(file, fileAttributes & ~attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveFileAttribute(String file, FileAttributes attribute)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
{
|
||||
var fileAttributes = File.GetAttributes(file);
|
||||
if ((fileAttributes & attribute) == attribute)
|
||||
{
|
||||
File.SetAttributes(file, fileAttributes & ~attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void StructuredCopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath, string tempLocation)
|
||||
{
|
||||
if (!Directory.Exists(destinationPath))
|
||||
{
|
||||
Directory.CreateDirectory(destinationPath);
|
||||
}
|
||||
|
||||
public static void StructuredCopyTo(this IEnumerable<LibraryAsset> assets, string destinationPath, string tempLocation)
|
||||
{
|
||||
if (!Directory.Exists(destinationPath))
|
||||
{
|
||||
Directory.CreateDirectory(destinationPath);
|
||||
}
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
var targetName = ResolveTargetName(destinationPath, asset);
|
||||
var transformedFile = asset.GetTransformedFile(tempLocation);
|
||||
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
var targetName = ResolveTargetName(destinationPath, asset);
|
||||
var transformedFile = asset.GetTransformedFile(tempLocation);
|
||||
File.Copy(transformedFile, targetName, overwrite: true);
|
||||
RemoveFileAttribute(targetName, FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
|
||||
File.Copy(transformedFile, targetName, overwrite: true);
|
||||
RemoveFileAttribute(targetName, FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
private static string ResolveTargetName(string destinationPath, LibraryAsset asset)
|
||||
{
|
||||
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)
|
||||
{
|
||||
string targetName;
|
||||
if (!string.IsNullOrEmpty(asset.RelativePath))
|
||||
{
|
||||
targetName = Path.Combine(destinationPath, asset.RelativePath);
|
||||
var destinationAssetPath = Path.GetDirectoryName(targetName);
|
||||
|
||||
if (!Directory.Exists(destinationAssetPath))
|
||||
{
|
||||
Directory.CreateDirectory(destinationAssetPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targetName = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||
}
|
||||
return targetName;
|
||||
}
|
||||
}
|
||||
if (!Directory.Exists(destinationAssetPath))
|
||||
{
|
||||
Directory.CreateDirectory(destinationAssetPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targetName = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||
}
|
||||
return targetName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue