From 3bcd1d973c6ccd34c01e97f44220f5d78065a6e5 Mon Sep 17 00:00:00 2001 From: Robert Sirre Date: Thu, 10 Oct 2019 11:38:05 +0200 Subject: [PATCH] Draft: execute using configured console Assumes %file% has been configured in console This needs some cleaning up I think. co-authored-by: @Aaltuj --- src/OpenCommandLine/OpenCommandLinePackage.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/OpenCommandLine/OpenCommandLinePackage.cs b/src/OpenCommandLine/OpenCommandLinePackage.cs index 904fbd5..8fdb198 100644 --- a/src/OpenCommandLine/OpenCommandLinePackage.cs +++ b/src/OpenCommandLine/OpenCommandLinePackage.cs @@ -76,7 +76,18 @@ private void ExecuteFile(object sender, EventArgs e) } else { - StartProcess(folder, "cmd.exe", "/k \"" + Path.GetFileName(path) + "\""); + var options = GetDialogPage(typeof(Options)) as Options; + string arguments = (options.Arguments ?? string.Empty).Replace("%folder%", folder); + + string confName = VsHelpers.GetSolutionConfigurationName(_dte); + arguments = arguments.Replace("%configuration%", confName); + + string confPlatform = VsHelpers.GetSolutionConfigurationPlatformName(_dte); + arguments = arguments.Replace("%platform%", confPlatform); + + arguments = arguments.Replace("%file%", Path.GetFileName(path)); + + StartProcess(folder, options.Command, arguments); } } @@ -102,6 +113,8 @@ private void OpenCustom(object sender, EventArgs e) string confPlatform = VsHelpers.GetSolutionConfigurationPlatformName(_dte); arguments = arguments.Replace("%platform%", confPlatform); + arguments = arguments.Replace("%file%", string.Empty); + StartProcess(folder, options.Command, arguments); }