public static void AssureDirectoryExist(string path) { if (!File.Exists(path)) { var directoryPath = MFileEx.GetDirectoryName(path); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } } }
public static void AssureFileExist(string path) { if (!File.Exists(path)) { var directoryPath = MFileEx.GetDirectoryName(path); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } FileStream fileStream = File.Create(path); fileStream.Close(); } }