osg::File Namespace Reference
[FileSystem]


Functions

File Functions
bool tstAttr (const Char8 *szFilename, UInt32 uiAccessFlags)


Detailed Description

File Functions

Function Documentation

bool osg::File::tstAttr ( const Char8 *  szFilename,
UInt32  uiAccessFlags 
) [inline]

Definition at line 84 of file OSGFileSystem.inl.

References osg::AccessFlags::IsReadable, osg::AccessFlags::IsWriteable, osg::OSGDIRFLAG, osg::OSGREADFLAG, and osg::OSGWRITEFLAG.

Referenced by osg::PathHandler::findFile().

00086     {
00087         bool  returnValue = false;
00088         Int32 rc          = 0;
00089         
00090 #ifdef WIN32
00091         struct _stat statBuffer;
00092 #else
00093         struct  stat statBuffer;
00094 #endif
00095         
00096         if(szFilename != NULL)
00097         {
00098 #ifdef WIN32
00099             rc = _stat(szFilename, &statBuffer);
00100 #else
00101             rc =  stat(szFilename, &statBuffer);
00102 #endif
00103             if(rc == 0 && ! (statBuffer.st_mode & OSGDIRFLAG))
00104             {
00105                 if(uiAccessFlags & AccessFlags::IsReadable)
00106                 {
00107                     if(statBuffer.st_mode & OSGREADFLAG)
00108                     {
00109                         returnValue = true;
00110                     }
00111                 }
00112                 
00113                 if(uiAccessFlags & AccessFlags::IsWriteable)
00114                 {
00115                     if(statBuffer.st_mode & OSGWRITEFLAG)
00116                     {
00117                         returnValue = true;
00118                     }
00119                 }
00120             }
00121         }
00122         
00123         return returnValue;
00124     }


Generated on Mon Mar 17 11:59:24 2008 for OpenSG by  doxygen 1.5.5