From Donny Cipperly, completed Windows support for fileType()

This commit is contained in:
Robert Osfield
2004-05-13 08:11:31 +00:00
parent 90579a0e17
commit f4a290cdff

View File

@@ -22,6 +22,8 @@
#include <Io.h>
#include <Windows.h>
#include <Winbase.h>
#include <sys/types.h>
#include <sys/stat.h>
// set up for windows so acts just like unix access().
#define F_OK 4
#else // unix
@@ -45,14 +47,18 @@ bool osgDB::fileExists(const std::string& filename)
osgDB::FileType osgDB::fileType(const std::string& filename)
{
#if defined(WIN32) && !defined(__CYGWIN__)
if (!fileExists(filename))
struct _stat fileStat;
if ( _stat(filename.c_str(), &fileStat) != 0 )
{
return FILE_NOT_FOUND;
}
else
{
} // end if
if ( fileStat.st_mode & _S_IFDIR )
return DIRECTORY;
else if ( fileStat.st_mode & _S_IFREG )
return REGULAR_FILE;
}
return FILE_NOT_FOUND;
#else
struct stat fileStat;