From 389784ec76c2fd8fe310b29506adc09130c43212 Mon Sep 17 00:00:00 2001 From: Sebastian Lindemeier Date: Thu, 4 Dec 2025 22:14:43 +0100 Subject: [PATCH] Replace hardcoded paths with environment variables --- AoC_2025.Runner/Program.cs | 9 +++++---- AoC_2025.Tests/Day01Test.cs | 5 +++-- AoC_2025.Tests/Day02Test.cs | 5 +++-- AoC_2025.Tests/Day03Test.cs | 5 +++-- AoC_2025.Tests/Day04Test.cs | 5 +++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/AoC_2025.Runner/Program.cs b/AoC_2025.Runner/Program.cs index 1d9e432..d899cd1 100644 --- a/AoC_2025.Runner/Program.cs +++ b/AoC_2025.Runner/Program.cs @@ -3,26 +3,27 @@ using System.Globalization; using AoC_2025; +var rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var day01 = new Day01(); -const string day01Path = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day01.txt"; +string day01Path = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day01.txt"; Console.WriteLine(day01.SolvePart1(day01Path)); Console.WriteLine(day01.SolvePart2(day01Path)); Console.WriteLine(); var day02 = new Day02(); -const string day02Path = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day02.txt"; +string day02Path = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day02.txt"; Console.WriteLine(day02.SolvePart1(day02Path)); Console.WriteLine(day02.SolvePart2(day02Path)); Console.WriteLine(); var day03 = new Day03(); -const string day03Path = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day03.txt"; +string day03Path = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day03.txt"; Console.WriteLine(day03.SolvePart1(day03Path)); Console.WriteLine(day03.SolvePart2(day03Path)); Console.WriteLine(); var day04 = new Day04(); -const string day04Path = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day04.txt"; +string day04Path = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day04.txt"; Console.WriteLine(day04.SolvePart1(day04Path)); Console.WriteLine(day04.SolvePart2(day04Path)); Console.WriteLine(); \ No newline at end of file diff --git a/AoC_2025.Tests/Day01Test.cs b/AoC_2025.Tests/Day01Test.cs index e1b7e75..1dbe0b2 100644 --- a/AoC_2025.Tests/Day01Test.cs +++ b/AoC_2025.Tests/Day01Test.cs @@ -5,8 +5,9 @@ namespace AoC_2025.Tests; public class Day01Test { private readonly IPuzzleSolver _sut; - private const string TestInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Test\day01.txt"; - private const string ProdInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day01.txt"; + private static readonly string rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + private readonly string TestInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Test\day01.txt"; + private readonly string ProdInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day01.txt"; public Day01Test() { diff --git a/AoC_2025.Tests/Day02Test.cs b/AoC_2025.Tests/Day02Test.cs index 1ce0a2b..fce2908 100644 --- a/AoC_2025.Tests/Day02Test.cs +++ b/AoC_2025.Tests/Day02Test.cs @@ -5,8 +5,9 @@ namespace AoC_2025.Tests; public class Day02Test { private readonly IPuzzleSolver _sut; - private const string TestInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Test\day02.txt"; - private const string ProdInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day02.txt"; + private static readonly string rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + private readonly string TestInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Test\day02.txt"; + private readonly string ProdInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day02.txt"; public Day02Test() { diff --git a/AoC_2025.Tests/Day03Test.cs b/AoC_2025.Tests/Day03Test.cs index 271d923..5467a0d 100644 --- a/AoC_2025.Tests/Day03Test.cs +++ b/AoC_2025.Tests/Day03Test.cs @@ -5,8 +5,9 @@ namespace AoC_2025.Tests; public class Day03Test { private readonly IPuzzleSolver _sut; - private const string TestInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Test\day03.txt"; - private const string ProdInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day03.txt"; + private static readonly string rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + private readonly string TestInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Test\day03.txt"; + private readonly string ProdInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day03.txt"; public Day03Test() { diff --git a/AoC_2025.Tests/Day04Test.cs b/AoC_2025.Tests/Day04Test.cs index 944d32b..e6baf53 100644 --- a/AoC_2025.Tests/Day04Test.cs +++ b/AoC_2025.Tests/Day04Test.cs @@ -5,8 +5,9 @@ namespace AoC_2025.Tests; public class Day04Test { private readonly IPuzzleSolver _sut; - private const string TestInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Test\day04.txt"; - private const string ProdInputPath = @"C:\Users\p01004051\Documents\AoC-PuzzleInputs\2025\Prod\day04.txt"; + private static readonly string rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + private readonly string TestInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Test\day04.txt"; + private readonly string ProdInputPath = @$"{rootPath}\AoC-PuzzleInputs\2025\Prod\day04.txt"; public Day04Test() {