public virtual string GetWorkingDirectory(string path)
{
if (string.IsNullOrWhiteSpace(path))
{
return CurrentDirectory;
}
var realPath = GetFullPath(path);
if (FileExists(realPath) || DirectoryExists(realPath))
{
if ((File.GetAttributes(realPath) & FileAttributes.Directory) == FileAttributes.Directory)
{
return realPath;
}
return Path.GetDirectoryName(realPath);
}
return Path.GetDirectoryName(realPath);
}