private static void EnsureDirectoryExists(string directory)
{
// Some assertions to make debugging easier.
Debug.Assert(!string.IsNullOrEmpty(directory), "directory parameter could not be null or an empty string.");
try
{
// Can't we see the directory in the file system?
if (!Directory.Exists(directory))
{
// Create it.
Directory.CreateDirectory(directory);
}
}
catch (IOException e)
{
throw new CodeWriterException(
string.Format("An error occurred while trying verify the output directory: {0}", e.Message), e);
}
}