I have a piece of code here that breaks if the directory doesn't exist:
System.IO.File.WriteAllText(filePath, content);
In one line (or a few lines), is it possible to check if the directory leading to the new file doesn't exist and if not, to create it before creating the new file?
I'm using .NET 3.5.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…