dotnet-installer/src/Microsoft.DotNet.Cli.Utils/CommandResolution/AppBaseDllCommandResolver.cs
Piotr Puszkiewicz 6fcbefa4f7 [WIP] Removes *3 verbs, making msbuild the driver (#4456)
Removes *3 verbs, making msbuild the driver
2016-10-27 18:46:43 -07:00

33 lines
1.2 KiB
C#

using System.IO;
using System.Linq;
using Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.DotNet.Cli.Utils
{
public class AppBaseDllCommandResolver : ICommandResolver
{
public CommandSpec Resolve(CommandResolverArguments commandResolverArguments)
{
if (commandResolverArguments.CommandName == null)
{
return null;
}
if (commandResolverArguments.CommandName.EndsWith(FileNameSuffixes.DotNet.DynamicLib))
{
var localPath = Path.Combine(ApplicationEnvironment.ApplicationBasePath,
commandResolverArguments.CommandName);
if (File.Exists(localPath))
{
var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(
new[] { localPath }
.Concat(commandResolverArguments.CommandArguments.OrEmptyIfNull()));
return new CommandSpec(
new Muxer().MuxerPath,
escapedArgs,
CommandResolutionStrategy.RootedPath);
}
}
return null;
}
}
}