From e6a84412b7f0d1bd5fcc15f71fc7fdb8a54bec2c Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Mon, 13 Dec 2010 10:07:39 +0000 Subject: [PATCH] Fixed Platform::GetFilesInDir() --- platform/platform_tests/platform_test.cpp | 3 +++ platform/qtplatform.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/platform/platform_tests/platform_test.cpp b/platform/platform_tests/platform_test.cpp index 1c4e2bd6dd..df585a3c08 100644 --- a/platform/platform_tests/platform_test.cpp +++ b/platform/platform_tests/platform_test.cpp @@ -73,6 +73,9 @@ UNIT_TEST(GetFilesInDir) Platform & pl = GetPlatform(); Platform::FilesList files; TEST_GREATER(pl.GetFilesInDir(pl.WritableDir(), "*.dat", files), 0, ("/data/ folder should contain some *.dat files")); + + TEST_EQUAL(pl.GetFilesInDir(pl.WritableDir(), "asdnonexistentfile.dsa", files), 0, ()); + TEST_EQUAL(files.size(), 0, ()); } UNIT_TEST(GetFileSize) diff --git a/platform/qtplatform.cpp b/platform/qtplatform.cpp index a954b5efc9..26672de153 100644 --- a/platform/qtplatform.cpp +++ b/platform/qtplatform.cpp @@ -285,6 +285,7 @@ public: virtual int 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();