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.
This commit is contained in:
2022-12-21 13:26:39 -06:00
parent 2d36c722a7
commit bb68e1d944

View File

@ -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))
{