static Boolean TestFile( String path) { #ifndef VMS int ret = 0; struct stat status; #if defined(WIN32) char buf[MAX_PATH]; char* bufp; int len; UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); if (AccessFile (path, buf, MAX_PATH, &bufp)) path = bufp; (void) SetErrorMode (olderror); #endif ret = (access(path, R_OK) == 0 && /* exists and is readable */ stat(path, &status) == 0 && /* get the status */ #ifndef X_NOT_POSIX S_ISDIR(status.st_mode) == 0); /* not a directory */ #else (status.st_mode & S_IFMT) != S_IFDIR); /* not a directory */ #endif /* X_NOT_POSIX else */ return ret; #else /* VMS */ return TRUE; /* Who knows what to do here? */ #endif /* VMS */ }
int AccessDirectory(const char *path, int mode) { #if O_XOS char tmp[MAXPATHLEN]; return _xos_access_dir(OsPath(path, tmp), access_mode(mode)) == 0 ? TRUE : FALSE; #else return AccessFile(path, mode); #endif }