public static void EnsureDirectoryExists(string directory) { if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } }