Skip to content

Commit

Permalink
Merge pull request #129 from DavidL344/bugfix/non-writable-wd
Browse files Browse the repository at this point in the history
Fix a stack overflow in non-writable working directories
  • Loading branch information
mayuki authored Jun 23, 2024
2 parents 07e27ae + 1b5fa9f commit 337647f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Cocona/Builder/Internal/BootstrapHostBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
Expand Down Expand Up @@ -45,7 +46,8 @@ public IHost Build()
HostingEnvironment = new HostEnvironment(hostConfiguration[HostDefaults.ApplicationKey]!, contentRootPath, new PhysicalFileProvider(contentRootPath), hostConfiguration[HostDefaults.EnvironmentKey] ?? Environments.Production)
};

configuration.SetBasePath(hostBuilderContext.HostingEnvironment.ContentRootPath);
var appLocation = Assembly.GetCallingAssembly().Location;
configuration.SetBasePath(Path.GetDirectoryName(appLocation)!);
configuration.AddConfiguration(hostConfiguration, true);
foreach (var action in _configureAppConfigs)
{
Expand Down

0 comments on commit 337647f

Please sign in to comment.