is_file.cpp 292 B

1234567891011121314
  1. #include "is_file.h"
  2. #include <sys/stat.h>
  3. IGL_INLINE bool igl::is_file(const char * filename)
  4. {
  5. struct stat status;
  6. if(stat(filename,&status)!=0)
  7. {
  8. // path does not exist
  9. return false;
  10. }
  11. // Tests whether existing path is a regular file
  12. return S_ISREG(status.st_mode);
  13. }