Skip to content

Commit

Permalink
Simplify dependencies and load appsettings from binary directory (#40)
Browse files Browse the repository at this point in the history
## Issue Description

Simplify dependencies for building and running in other development
environments.

## Change Description

* Copy all `*.rcl` files to output directory, not just `thirdparty.rcl`
- if other environments locally have more files
* Just build a `Configuration` object, as we don't need an `IHost`
object
* Set the path for the `Configuration` object to be the application
install directory
  • Loading branch information
elliekorn authored Aug 14, 2023
1 parent 93e98a0 commit e705888
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion MemorySnapshotAnalyzer/MemorySnapshotAnalyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="thirdparty.rcl">
<None Update="*.rcl">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="treemap.html">
Expand Down
8 changes: 4 additions & 4 deletions MemorySnapshotAnalyzer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
using MemorySnapshotAnalyzer.Commands;
using MemorySnapshotAnalyzer.UnityBackend;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;

static class Program
{
[STAThread]
public static int Main(string[] args)
{
using IHost host = Host.CreateDefaultBuilder(args).Build();
IConfiguration configuration = host.Services.GetRequiredService<IConfiguration>();
IConfiguration configuration = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json", optional: true)
.Build();

using Repl repl = new(configuration);

Expand Down
2 changes: 0 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

cp MemorySnapshotAnalyzer/appsettings.json .
cp MemorySnapshotAnalyzer/thirdparty.rcl .
exec dotnet run --project MemorySnapshotAnalyzer/MemorySnapshotAnalyzer.csproj

0 comments on commit e705888

Please sign in to comment.