From bb68e1d944d424c0e2c7541088f29cdf305dec32 Mon Sep 17 00:00:00 2001 From: Parnic Date: Wed, 21 Dec 2022 13:26:39 -0600 Subject: [PATCH] Fix Rider profiler on Windows I don't know why, but in a Profiling run, File.Exists() returns true for a file that very much does not exist. Adding the directory check enables it to get the actually-correct answer. Another option is handling an exception in File.ReadLines, but I'm ok with this for now. This doesn't fix Rider's profiler on macos, though...on mac, it hangs forever thinking that input is redirected but not actually having anything in the buffer. I haven't found a fix for that yet. --- src/Util/Parsing.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Util/Parsing.cs b/src/Util/Parsing.cs index e213a6e..25c6a6a 100644 --- a/src/Util/Parsing.cs +++ b/src/Util/Parsing.cs @@ -46,6 +46,7 @@ public static class Parsing var filename = $"inputs/{inputName}.txt"; if (File.Exists(filename)) + if (Directory.Exists(Path.GetDirectoryName(filename)!) && File.Exists(filename)) { foreach (var line in File.ReadLines(filename)) {