I've got some code for listing the contents of a directory on linux, but no way of determining if the object is a file or a directory, short of calling opendir each time to check. Just wondered if there are any other ways.
Thanks
typedef std::multimap< std::string, std::string > DirectoryList;
void LinuxPlatform::getDirectoryListing( std::string inDirectory, DirectoryList & outList )
{
struct dirent *dirp;
DIR *dp;
if( ( dp = opendir( inDirectory.c_str() ) ) != 0 )
{
while( ( dirp = readdir( dp ) ) != 0 )
{
if( dirp->d_name[0] != '.' )
{
outList.insert( std::make_pair( "File", dirp->d_name ) );
}
}
closedir( dp );
}
else
{
printf( "Invalid Directory\n" );
}
}