osg::Directory Namespace Reference
[FileSystem]


Functions

Directory Functions
bool tstAttr (const Char8 *szDirname, UInt32 uiAccessFlags)
Char8getCurrent (void)
bool setCurrent (const Char8 *szDirname)
std::vector< Char8 * > * getEntries (const Char8 *szDirname, const Char8 *szPattern)


Detailed Description

Directory Functions

Function Documentation

bool osg::Directory::tstAttr ( const Char8 *  szDirname,
UInt32  uiAccessFlags 
) [inline]

Definition at line 141 of file OSGFileSystem.inl.

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

Referenced by getEntries().

00143     {
00144         bool  returnValue = false;
00145         Int32 rc          = 0;
00146         
00147 #ifdef WIN32
00148         struct _stat statBuffer;
00149 #else
00150         struct  stat statBuffer;
00151 #endif
00152         
00153         if(szDirname != NULL)
00154         {
00155 #ifdef WIN32
00156             rc = _stat(szDirname, &statBuffer);
00157 #else
00158             rc = stat(szDirname, &statBuffer);
00159 #endif
00160             
00161             if(rc == 0 && (statBuffer.st_mode & OSGDIRFLAG))
00162             {
00163                 if(uiAccessFlags & AccessFlags::IsReadable)
00164                 {
00165                     if(statBuffer.st_mode & OSGREADFLAG)
00166                     {
00167                         returnValue = true;
00168                     }
00169                     else
00170                     {
00171                         returnValue = false;
00172                     }
00173                 }
00174                 
00175                 if(uiAccessFlags & AccessFlags::IsWriteable)
00176                 {
00177                     if(statBuffer.st_mode & OSGWRITEFLAG)
00178                     {
00179                         returnValue = true;
00180                     }
00181                     else
00182                     {
00183                         returnValue = false;
00184                     }
00185                 }
00186             }
00187         }
00188         
00189         return returnValue;
00190     }

bool osg::Directory::setCurrent ( const Char8 *  szDirname  )  [inline]

Definition at line 231 of file OSGFileSystem.inl.

00232     {
00233         bool returnValue = false;
00234         
00235         if(szDirname != NULL)
00236         {
00237 #ifndef WIN32
00238             if(chdir(szDirname) == 0)
00239                 returnValue = true;
00240 #else
00241             if(_chdir(szDirname) == 0)
00242                 returnValue = true;
00243 #endif
00244         }
00245         
00246         return returnValue;
00247     }


Generated on Mon Mar 17 13:00:27 2008 for OpenSG by  doxygen 1.5.5