Fix various path issues

This commit is contained in:
SteveSandersonMS
2015-11-05 11:46:10 -08:00
parent b5fb560c54
commit 46dc743177
12 changed files with 52 additions and 39 deletions

View File

@@ -1,21 +1,23 @@
using Microsoft.Dnx.Runtime;
using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.NodeServices {
public static class Configuration {
public static void AddNodeServices(this IServiceCollection serviceCollection, NodeHostingModel hostingModel = NodeHostingModel.Http) {
serviceCollection.AddSingleton(typeof(INodeServices), (serviceProvider) => {
return CreateNodeServices(hostingModel);
var appEnv = serviceProvider.GetRequiredService<IApplicationEnvironment>();
return CreateNodeServices(hostingModel, appEnv.ApplicationBasePath);
});
}
public static INodeServices CreateNodeServices(NodeHostingModel hostingModel)
public static INodeServices CreateNodeServices(NodeHostingModel hostingModel, string projectPath)
{
switch (hostingModel)
{
case NodeHostingModel.Http:
return new HttpNodeInstance();
return new HttpNodeInstance(projectPath);
case NodeHostingModel.InputOutputStream:
return new InputOutputStreamNodeInstance();
return new InputOutputStreamNodeInstance(projectPath);
default:
throw new System.ArgumentException("Unknown hosting model: " + hostingModel.ToString());
}