diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/FileMatchResult.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/FileMatchResult.cs new file mode 100644 index 0000000000..cbaf9c52da --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/FileMatchResult.cs @@ -0,0 +1,15 @@ +namespace Volo.Abp.Cli.LIbs +{ + public class FileMatchResult + { + public string Path { get; } + + public string Stem { get; } + + public FileMatchResult(string path, string stem) + { + Path = path; + Stem = stem; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs index bf84e4863c..5379c62aed 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs @@ -110,19 +110,18 @@ namespace Volo.Abp.Cli.LIbs foreach (var mapping in resourceMapping.Mappings) { var destPath = Path.Combine(fileDirectory, mapping.Value); - var files = FindFiles(fileDirectory, mapping.Key); foreach (var file in files) { - var destFilePath = Path.Combine(destPath, Path.GetFileName(file)); + var destFilePath = Path.Combine(destPath, file.Stem); if (File.Exists(destFilePath)) { continue; } - Directory.CreateDirectory(Path.GetFullPath(destPath)); - File.Copy(file, destFilePath); + Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)); + File.Copy(file.Path, destFilePath); } } @@ -146,9 +145,9 @@ namespace Volo.Abp.Cli.LIbs foreach (var file in files) { - if (File.Exists(file)) + if (File.Exists(file.Path)) { - File.Delete(file); + File.Delete(file.Path); } } @@ -161,7 +160,7 @@ namespace Volo.Abp.Cli.LIbs } } - private string[] FindFiles(string directory, params string[] patterns) + private List FindFiles(string directory, params string[] patterns) { var matcher = new Matcher(); @@ -179,7 +178,7 @@ namespace Volo.Abp.Cli.LIbs var result = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directory))); - return result.Files.Select(x => Path.Combine(directory, x.Path)).ToArray(); + return result.Files.Select(x => new FileMatchResult(Path.Combine(directory, x.Path), x.Stem)).ToList(); } private string NormalizeGlob(string pattern)