// /*-------------------------------------------------------------------*\ // | Concrete Instance Body : File_Operations // \*-------------------------------------------------------------------*/ ///------------------------------------------------------------------------ /// Global Context -------------------------------------------------------- ///------------------------------------------------------------------------ #include "RAW_Foundation.h" // Note the following hack, since "select" is defined in one of the // following include files... #undef select // Common constants (for Unix): R_OK, W_OK, X_OK, F_OK #include // #include #include ///------------------------------------------------------------------------ /// Public Operations ----------------------------------------------------- ///------------------------------------------------------------------------ Boolean File_Exists (Text path_name) { return (access (path_name.Contents (), F_OK) == 0); } //------------------------------------------------------------------------- Boolean File_Is_Readable (Text path_name) { return (access (path_name.Contents (), R_OK) == 0); } //------------------------------------------------------------------------- Boolean File_Is_Writeable (Text path_name) { return (access (path_name.Contents (), W_OK) == 0); } //------------------------------------------------------------------------- Boolean File_Is_Executable (Text path_name) { return (access (path_name.Contents (), X_OK) == 0); } //------------------------------------------------------------------------- Boolean File_Is_A_Directory (Text path_name) { object DIR* d = opendir (path_name.Contents ()); object Boolean is_directory = d != NULL; if (is_directory) { closedir (d); } return is_directory; } //-------------------------------------------------------------------------