Fixed load .gset file error (#293)

This commit is contained in:
chenshungen 2018-01-05 19:33:33 +08:00 committed by Jakob Botsch Nielsen
parent 0004bf4a23
commit bda59b7c62

View File

@ -55,10 +55,11 @@ void scanDirectoryAppend(const string& path, const string& ext, vector<string>&
return; return;
} }
int extLen = strlen(ext.c_str());
while ((current = readdir(dp)) != 0) while ((current = readdir(dp)) != 0)
{ {
int len = strlen(current->d_name); 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); filelist.push_back(current->d_name);
} }