private static Stream OpenFile(PlatformAdaptationLayer pal, string name, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) { if (pal.DirectoryExists(name)) { // TODO: properly set errno throw PythonOps.IOError("[Errno 13] Permission denied"); } return pal.OpenInputFileStream(name, fileMode, fileAccess, fileShare); }