Skip to content

Commit 717a1e6

Browse files
committed
Fix input for benchmarks
1 parent cc638c0 commit 717a1e6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
namespace Bussell.AdventOfCode.Solutions;
22

3+
using System.Runtime.CompilerServices;
4+
35
public abstract class SolutionWithTextInput : ISolution
46
{
57
public SolutionWithTextInput()
68
{
7-
Input = File.ReadAllLines(InputFileName);
9+
string basePath = Path.GetDirectoryName(WhereAmI())
10+
?? throw new InvalidOperationException("Could not determine base path.");
11+
Input = File.ReadAllLines(Path.Combine(basePath, InputFileName));
812
}
913

1014
public abstract int Day { get; }
1115

1216
public abstract string Name { get; }
1317

14-
protected string InputFileName => $"Inputs/{Day:D2}.txt";
18+
protected string InputFileName => $"../Inputs/{Day:D2}.txt";
1519

1620
protected IEnumerable<string> Input { get; }
1721

1822
public abstract string SolvePart1();
1923

2024
public abstract string SolvePart2();
25+
26+
private static string WhereAmI([CallerFilePath] string callerFilePath = "") => callerFilePath;
2127
}

0 commit comments

Comments
 (0)