From bdd2a8a86cc090ce12632fd2a4f8c97304649877 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 5 Apr 2021 09:53:17 +0300 Subject: [PATCH] Refactor MicroserviceServiceRandomPortStep --- .../MicroserviceServiceRandomPortStep.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs index 88a19b43af..befc5414eb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs @@ -59,9 +59,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return _tyeFileContent; } - var solutionFolderPath = context.BuildArgs.ExtraProperties[NewCommand.Options.OutputFolder.Short] ?? - context.BuildArgs.ExtraProperties[NewCommand.Options.OutputFolder.Long] ?? - Directory.GetCurrentDirectory(); + var solutionFolderPath = GetSolutionFolderPath(context); var tyeFilePath = Path.Combine(solutionFolderPath, "tye.yaml"); @@ -74,5 +72,20 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return _tyeFileContent; } + + private static string GetSolutionFolderPath(ProjectBuildContext context) + { + if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.OutputFolder.Short)) + { + return context.BuildArgs.ExtraProperties[NewCommand.Options.OutputFolder.Short]; + } + + if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.OutputFolder.Long)) + { + return context.BuildArgs.ExtraProperties[NewCommand.Options.OutputFolder.Long]; + } + + return Directory.GetCurrentDirectory(); + } } }