r/ProgrammerTIL • u/C4Oc • Apr 03 '21
.NET [C#] Today I learned that attempting to create a file with a path string equal to a directory path literally creates an empty file
I struggled to find out why my programs couldn't load player settings or store them for weeks. And today I found the reason: I tried to create directories using File.Create(path) instead of Directory.CreateDirectory(path). At least I found the mistake
37
Upvotes
10
u/HighRelevancy Apr 04 '21
What? Like yeah obviously. Why would file.create create directories?
0
u/[deleted] Apr 03 '21
[deleted] — view deleted comment