Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Remove usage of PlatformAbstractions (#192)
Browse files Browse the repository at this point in the history
* Remove unnecessary using

The PlatformAbstractions library is going to be removed from dotnet/runtime.

Contributes to dotnet/runtime#3470

* Change ApplicationBasePath to AppContext.BaseDirectory
  • Loading branch information
eerhardt authored May 6, 2020
1 parent 9f49d1b commit 4106499
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/NugetSymbolServer/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -17,7 +16,7 @@ public Startup(IHostingEnvironment hostingEnvironment, IConfigurationSource host
{
Configuration =
new ConfigurationBuilder()
.SetBasePath(ApplicationEnvironment.ApplicationBasePath)
.SetBasePath(AppContext.BaseDirectory)
.Add(hostProvidedConfiguration)
.AddJsonFile("config.json", optional: hostingEnvironment.IsDevelopment())
.AddJsonFile($"config.{hostingEnvironment.EnvironmentName}.json", optional: true)
Expand All @@ -28,7 +27,7 @@ public Startup(IHostingEnvironment hostingEnvironment, IConfigurationSource host

LoggingConfiguration =
new ConfigurationBuilder()
.SetBasePath(ApplicationEnvironment.ApplicationBasePath)
.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("logging.json", optional: true)
.AddJsonFile($"logging.{hostingEnvironment.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables()
Expand All @@ -52,7 +51,7 @@ public void ConfigureServices(IServiceCollection services)
throw new Exception("No configuration specified for FileCache:CachePath");
}
cachePath = Environment.ExpandEnvironmentVariables(cachePath);
options.RootPath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, cachePath);
options.RootPath = Path.Combine(AppContext.BaseDirectory, cachePath);
})
.Configure<DirectoryPackageSourceOptions>(options =>
{
Expand All @@ -62,7 +61,7 @@ public void ConfigureServices(IServiceCollection services)
throw new Exception("No configuration specified for PackageSource:SourcePath");
}
sourcePath = Environment.ExpandEnvironmentVariables(sourcePath);
options.SourcePath = Path.Combine(ApplicationEnvironment.ApplicationBasePath, sourcePath);
options.SourcePath = Path.Combine(AppContext.BaseDirectory, sourcePath);
})
.AddSingleton<IFileStore, FileStore>()
.AddSingleton<ISymbolAccess, PackageBasedSymbolStore>()
Expand All @@ -88,4 +87,4 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
app.UseStaticFiles();
}
}
}
}

0 comments on commit 4106499

Please sign in to comment.