Skip to content

Instantly share code, notes, and snippets.

@dsimunic
Created December 27, 2013 17:23
Show Gist options
  • Save dsimunic/8149893 to your computer and use it in GitHub Desktop.
Save dsimunic/8149893 to your computer and use it in GitHub Desktop.
static class PathExtensions
{
public static string EnsureFolderExists(this string path)
{
if (string.IsNullOrEmpty(path))
return path;
string fullPath = Path.GetFullPath(path);
if (!Directory.Exists(fullPath))
Directory.CreateDirectory(fullPath);
return fullPath;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment