[qt] Do not clear files list in Platform::GetFilesInDir()

This commit is contained in:
Alex Zolotarev 2011-11-15 19:57:57 +03:00 committed by Alex Zolotarev
parent 26ca372425
commit b8a1a7f8c8
2 changed files with 3 additions and 5 deletions

View file

@ -26,7 +26,6 @@ bool Platform::GetFileSize(string const & file, uint64_t & size) const
void Platform::GetFilesInDir(string const & directory, string const & mask, FilesList & outFiles) const
{
outFiles.clear();
QDir dir(directory.c_str(), mask.c_str(), QDir::Unsorted,
QDir::Files | QDir::Readable | QDir::Dirs | QDir::NoDotAndDotDot);
int const count = dir.count();
@ -55,10 +54,7 @@ void Platform::GetFontNames(FilesList & res) const
GetFilesInDir(WritableDir(), "*.ttf", res);
res.resize(unique(res.begin(), res.end()) - res.begin());
sort(res.begin(), res.end());
#ifdef DEBUG
for (size_t i = 0; i < res.size(); ++i)
LOG(LDEBUG, ("Found font:", res[i]));
#endif
CHECK(!res.empty(), ("Can't find any valid font in", ResourcesDir(), WritableDir()));
}
int Platform::MaxTilesCount() const

View file

@ -68,6 +68,8 @@ UNIT_TEST(GetFilesInDir)
pl.GetFilesInDir(pl.WritableDir(), "*" DATA_FILE_EXTENSION, files);
TEST_GREATER(files.size(), 0, ("/data/ folder should contain some data files"));
files.clear();
pl.GetFilesInDir(pl.WritableDir(), "asdnonexistentfile.dsa", files);
TEST_EQUAL(files.size(), 0, ());
}