protected void SafeDirectoryChange( string directory, Action action )
{
if ( Directory.Exists( directory ) )
{
// Check we can change to it
pushDirectory( directory );
try
{
action();
}
catch ( Exception ex )
{
LogManager.Instance.Write( LogManager.BuildExceptionString( ex ) );
}
finally
{
// return to previous
popDirectory();
}
}
}