Why agk::GetFirstFile() and agk::GetNextFile() work under Windows, but under iOS do not work?
inline std::vector<std::string> GetFileList( const char* szPath, const char* szExt = "*" )
{
agk::SetFolder ( szPath );
std::vector<string> filelist;
char* filefind = agk::GetFirstFile();
char* fileExt = "";
if ( strcmp ( filefind, "" ) != 0 )
{
fileExt = agk::GetStringToken( filefind, ".", 2 );
if ( strcmp ( szExt, "*" ) == 0 || strcmp ( szExt, fileExt ) == 0 )
{
filelist.push_back( filefind );
}
while ( strcmp ( filefind, "" ) != 0 )
{
filefind = agk::GetNextFile();
if ( strcmp ( filefind, "" ) != 0 )
{
fileExt = agk::GetStringToken( filefind, ".", 2 );
if ( strcmp(szExt,"*") == 0 || strcmp (szExt, fileExt) == 0 )
{
filelist.push_back( filefind );
}
}
}
}
else
{
agk::Error ( "GetFirstFile() - empty!" );
}
if ( filelist.empty() )
{
char szText[256] = "";
sprintf ( szText, "Directory: '%s' is empty!", szPath );
agk::Error ( szText );
}
std::sort ( filelist.begin(), filelist.end() );
agk::SetFolder ( "" );
return filelist;
}
Life is our game, playing we live!