public override void SetCurrentDirectory(string fullPath)
{
if (!Interop.Kernel32.SetCurrentDirectory(fullPath))
{
// If path doesn't exist, this sets last error to 2 (File
// not Found). LEGACY: This may potentially have worked correctly
// on Win9x, maybe.
int errorCode = Marshal.GetLastWin32Error();
if (errorCode == Interop.Errors.ERROR_FILE_NOT_FOUND)
errorCode = Interop.Errors.ERROR_PATH_NOT_FOUND;
throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath);
}
}