diff --git a/RecastDemo/Source/Filelist.cpp b/RecastDemo/Source/Filelist.cpp index 8a8b7c9..7e05130 100644 --- a/RecastDemo/Source/Filelist.cpp +++ b/RecastDemo/Source/Filelist.cpp @@ -55,10 +55,11 @@ void scanDirectoryAppend(const string& path, const string& ext, vector& return; } + int extLen = strlen(ext.c_str()); while ((current = readdir(dp)) != 0) { int len = strlen(current->d_name); - if (len > 4 && strncmp(current->d_name + len - 4, ext.c_str(), 4) == 0) + if (len > extLen && strncmp(current->d_name + len - extLen, ext.c_str(), extLen) == 0) { filelist.push_back(current->d_name); } @@ -74,4 +75,4 @@ void scanDirectory(const string& path, const string& ext, vector& fileli { filelist.clear(); scanDirectoryAppend(path, ext, filelist); -} \ No newline at end of file +}